Rider « Game Cartoon « Flash Tutorials

Home
Flash Tutorials
1.Actionscript Programming
2.Animals
3.Animation
4.Colors
5.Design
6.Effects
7.Game Cartoon
8.Humans
9.Models
10.Nature
11.Operations
12.Shapes
Flex
Flash / Flex / ActionScript
Flash Tutorials » Game Cartoon » Rider 

1. Create a flash draw game like Line Rider or others – part 1 : Emanuele Feronato    emanueleferonato.com

Let's analyze the script: Line 1: create the movie clip instanced as "terrain" Line 2: set the style of the line I am going to draw Line 3: initialize a flag saying that I am not drawing Line 4: Actions to perform when the mouse is "down" (when I click the mouse) Lines 5-8: If i am not drawing, move the "pen" at current mouse location and set the drawing variable at true, to tell the script that now I am drawing Lines 9-13: If I am drawing, every time I enter the frame a line is traced from the last line drawn to the actual mouse location Lines 15-19: If the mouse is "up" (I am not clicking the mouse), the imdrawing variable is set back to false value each time I enter the frame. The onEnterFrame here may seem useles but without it, the script won't work and if you start drawing, you will continue drawing even if the mouse button is not pressed.

2. Create a flash draw game like Line Rider or others - part 2    emanueleferonato.com

Lines 1-5: These instructions are execute only once, when the ball firstly appears on the stage. If you followed my flash game creation tutorial you are familiar with those instructions. I am defining ball x and y speed (set to 0, the ball does not move) and the gravity.

3. Create a flash draw game like Line Rider or others - part 3    emanueleferonato.com

Create a flash draw game like Line Rider or others - part 3Lines 28-34: Determining ball direction angle starting from its xspeed and yspeed (opposite and adjacent). The xspeed is multiplied by -1 because, unlike previous examples, when xspeed is greater than zero means I am moving from left to right, and when xspeed is less than zero means I am moving from right to left.

4. Create a flash draw game like Line Rider or others - part 4    emanueleferonato.com

Create a flash draw game like Line Rider or others - part 4Now you should be ready to create your first ball drawing game... why don't you send me your works? I will publish on this site.

5. Create a flash draw game like Line Rider or others - part 5    emanueleferonato.com

Lines 12-13: The yspeed value is added to _y (old line 12) only if the player is in the air. Look at the +1 in the _y+_height/2+1. I need to "forecast" next player's position and if I find it will be in the ground, then I stop considering the gravity. Otherwise lines 14-15 set yspeed to zero.

java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.