Tuesday, July 22, 2008

Creating Simple Enemy


In order to understand this short tutorial first read Character Elastic Movement and Adding mc speed using Numeric Stepper component posts. Next step is to create simple enemy and to animate that enemy.


We have new movie clip (green rectangle) that represents enemy in our game. Instance of enemy movie clip is on stage and that instance is named mc_enemy. First we want to create very basic enemy movement in single horizontal line. When enemy reaches stage end it changes direction. Before we define function for movement we want to give our new movie clip starting direction. Let’s make a deal : if direction has value 1, enemy goes left and if direction has value 2, enemy goes right.

Starting direction is determent by variable dir like this:

var dir:Number = new Number(1);

This will force our movie clip to start moving left when we define function onEnterFrame for movie clip mc_enemy. Function is simple, has 4 if conditional statement and they define simple enemy movement. We have modified coordinates where enemy movie clip changes direction for 15 pixels, which is half of movie clip’s width. In this way border bounce is better.




Download : file.

Next time we will see how we can detect collision between our Hero and Enemy.
Posted by flanture at 01:35:46 | Permanent Link | Comments (0) |

Friday, July 04, 2008

Design for Mobile conference

If you have a chance to be near Kansas, US between 22-24 September, 2008 don’t miss Eldridge Hotel, Lawrence and Mobile user experience conference.

In their own words: "Design For Mobile will be the first North American mobile user experience conference. This will be a two-day conference focused on strategy and tactics for user research, product definition, interaction and other design, and usability testing."

Check speakers list.
Posted by flanture at 13:42:42 | Permanent Link | Comments (0) |