Flash game creation tutorial - part 3

March 14th update: part 5.3 released.
March 3rd update: part 5.2 released.
February 9th update: part 5.1 released.
December 31st update: 5th part released.
December 23rd update: 4th part released.

Here we go with the 3rd step.

Remember to read 1st and 2nd part if you are new to this tutorial, and let's go.

We left our hero colleting coins, so next step will be...

The score

Scoring system consist in a variable set to 0 (zero) when the game starts and some events that may increase/decrease the score.

In this case, you get 1 point when you collect a coin, and lose 2 points when you crash into a wall.

Hall I have to do is initializing a variable in the root with a single action

ACTIONSCRIPT:
  1. score = 0;

And then in the hero movieclip

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 0.65;
  6.     gravity = 0.1;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9. }
  10. onClipEvent (enterFrame) {
  11.     if (Key.isDown(Key.LEFT)) {
  12.         xspeed = xspeed-power;
  13.     }
  14.     if (Key.isDown(Key.RIGHT)) {
  15.         xspeed = xspeed+power;
  16.     }
  17.     if (Key.isDown(Key.UP)) {
  18.         yspeed = yspeed-power*upconstant;
  19.     }
  20.     if (Key.isDown(Key.DOWN)) {
  21.         yspeed = yspeed+power*upconstant;
  22.     }
  23.     xspeed = (xspeed+wind)*friction;
  24.     yspeed = yspeed+gravity;
  25.     _y = _y+yspeed;
  26.     _x = _x+xspeed;
  27.     _rotation = _rotation+xspeed;
  28.     if (_root.wall.hitTest(_x, _y, true)) {
  29.         xspeed = 0;
  30.         yspeed = 0;
  31.         _x = 120;
  32.         _y = 120;
  33.         _root.score -=2;
  34.     }
  35.     if (_root.coin.hitTest(this.hero_hit)) {
  36.         _root.coin._x = Math.random()*400+50;
  37.         _root.score ++;
  38.     }
  39. }

Look at lines 33 and 37... as said, you get one point when you collect a coin and lose 2 points when you hit the wall.
A dynamic text in the main scene displays the score.

Sooooo easy... now let me introduce you the main event for this tutorial... the environment...

We can have different kinds of environment... let's start with the easiest.

The killing fixed environment

The killing fixed environment is a deadly part of the stage that does not move, such as a spike.

So I created a new movieclip called environment and instanced as environment and placed in the stage.
You choose how to detect the collision, with the center of the hero or with the hero_hit shape (time to read part 2 if you do not understand what I am talking about).

Just remember you game does not have to be too easy or too hard.

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 0.65;
  6.     gravity = 0.1;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9. }
  10. onClipEvent (enterFrame) {
  11.     if (Key.isDown(Key.LEFT)) {
  12.         xspeed = xspeed-power;
  13.     }
  14.     if (Key.isDown(Key.RIGHT)) {
  15.         xspeed = xspeed+power;
  16.     }
  17.     if (Key.isDown(Key.UP)) {
  18.         yspeed = yspeed-power*upconstant;
  19.     }
  20.     if (Key.isDown(Key.DOWN)) {
  21.         yspeed = yspeed+power*upconstant;
  22.     }
  23.     xspeed = (xspeed+wind)*friction;
  24.     yspeed = yspeed+gravity;
  25.     _y = _y+yspeed;
  26.     _x = _x+xspeed;
  27.     _rotation = _rotation+xspeed;
  28.     if (_root.wall.hitTest(_x, _y, true)) {
  29.         xspeed = 0;
  30.         yspeed = 0;
  31.         _x = 50;
  32.         _y = 50;
  33.     }
  34.     if (_root.environment.hitTest(_x, _y, true)) {
  35.         xspeed = 0;
  36.         yspeed = 0;
  37.         _x = 50;
  38.         _y = 50;
  39.     }
  40. }

Lines 34-39 do the routine that checks collision between the hero and the environment

This is useful if you want to place objects on the stage that may kill the hero.

Sometimes, the environment should move.

The killing tweened environment

I am calling "tweened environment" an object that always moves along a path... such as a sliding wall or something similar.

The actionscript, obviously, is the same as above, the only change is to the environment object, that now has a tweening motion. You'll see it better when you will download the sources, at the end of this tutorial.

The only thing I want you to know is: for a better result, the number of pixels the environment moves at every frame should be an integer. I mean that if you want to move your environment by 150 pixels, be sure that dividing the pixels for the numbers of frames you have an integer number.
In my case, I move the environment by 150 pixels in 75 frames... 150/75 = 2 (integer) pixels/frame.
It's not a mandatory rule, and in most cases you will experience it is impossible to achieve such integer numbers, while you can do it, well, do it.

Sometimes we want the hero to interact with environment, so I will explain howo to get...

The triggered environment

Let's suppose to have a wall that moves very fast... making our life so hard... we should let the player decide to cross the wall, risking his life, or turn off the "engine" that moves the wall, for example pushing a button or pulling a lever.

In this new movie I created a new object named as trigger and instanced as trig, with the shape of a lever.

Then I added some actionscript to the environment, that is no longer tweened.

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     dir = 4;
  3.     moving = 1;
  4. }
  5. onClipEvent (enterFrame) {
  6.     if (moving) {
  7.         _y += dir;
  8.         if (_y>300) {
  9.             dir = -4;
  10.         }
  11.         if (_y<50) {
  12.             dir = 4;
  13.         }
  14.     }
  15. }

This is a very simple movement routine... I will explain more complex routines later in the tutorial, but at the moment I only want a wall to cross the stage up and down, and the hero to get the trigger to stop it.

The script is very simple, just take a look at the moving variable. You can see that the environment will move by 4 pixels (integer...) upwards or downwards as long as the moving variable is set to 1.

How can we stop it?

With lines 40-43 of the hero's actionscript

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 0.65;
  6.     gravity = 0.1;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9. }
  10. onClipEvent (enterFrame) {
  11.     if (Key.isDown(Key.LEFT)) {
  12.         xspeed = xspeed-power;
  13.     }
  14.     if (Key.isDown(Key.RIGHT)) {
  15.         xspeed = xspeed+power;
  16.     }
  17.     if (Key.isDown(Key.UP)) {
  18.         yspeed = yspeed-power*upconstant;
  19.     }
  20.     if (Key.isDown(Key.DOWN)) {
  21.         yspeed = yspeed+power*upconstant;
  22.     }
  23.     xspeed = (xspeed+wind)*friction;
  24.     yspeed = yspeed+gravity;
  25.     _y = _y+yspeed;
  26.     _x = _x+xspeed;
  27.     _rotation = _rotation+xspeed;
  28.     if (_root.wall.hitTest(_x, _y, true)) {
  29.         xspeed = 0;
  30.         yspeed = 0;
  31.         _x = 450;
  32.         _y = 50;
  33.     }
  34.     if (_root.environment.hitTest(_x, _y, true)) {
  35.         xspeed = 0;
  36.         yspeed = 0;
  37.         _x = 450;
  38.         _y = 50;
  39.     }
  40.     if (_root.trig.hitTest(_x, _y, true)) {
  41.         _root.trig.gotoAndStop(2);
  42.         _root.environment.moving = 0;
  43.     }
  44. }

If the hero hits the trigger (as explained before, you will decide the type of collision checking later when you will test the entire game), the trigger frame is moved to 2 displaying a pulled lever and the moving variable is set to 0.
In this case, the actionscript of the environment won't enter in the if condition and the environment will stop.

Possibile applications of this routine are almost infinite: imagine buttons that stops dangerous object moving, levers that reveals hidden zones with treasures, and so on.

We will discover all those options when the game will be in progress... remember that at the moment I am just showing you the basics.

Talking about basics, let's see a type of environment that as far as I know is not included in ball:revamped (of course we always have to try to improve existing concepts).

The undeadly environment

I want an environment that does not kill the hero, but that changes some behaviours... imagine a stage that is partially flooded.
You have water in the stage, and your hero underwater movements will be more difficult.

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 0.65;
  6.     gravity = 0.1;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9.     sunken = 0;
  10. }
  11. onClipEvent (enterFrame) {
  12.     if (Key.isDown(Key.LEFT)) {
  13.         xspeed = xspeed-power;
  14.     }
  15.     if (Key.isDown(Key.RIGHT)) {
  16.         xspeed = xspeed+power;
  17.     }
  18.     if (Key.isDown(Key.UP)) {
  19.         yspeed = yspeed-power*upconstant;
  20.     }
  21.     if (Key.isDown(Key.DOWN)) {
  22.         yspeed = yspeed+power*upconstant;
  23.     }
  24.     xspeed = (xspeed+wind)*friction;
  25.     yspeed = yspeed+gravity;
  26.     if(sunken == 0){
  27.         _y = _y+yspeed;
  28.         _x = _x+xspeed;
  29.     }
  30.     else{
  31.         _y = _y+(yspeed/5);
  32.         _x = _x+(xspeed/3);
  33.     }
  34.     _rotation = _rotation+xspeed;
  35.     if (_root.wall.hitTest(_x, _y, true)) {
  36.         xspeed = 0;
  37.         yspeed = 0;
  38.         _x = 50;
  39.         _y = 50;
  40.     }
  41.     if (_root.environment.hitTest(_x, _y, true)) {
  42.         sunken = 1;
  43.     }
  44.     else{
  45.         sunken = 0;
  46.     }
  47. }

Line 9 has a new variable that determines if the hero is underwater or not.
Then, when it's time to update hero's position according to gravity, speed, and so on...
Lines 26-33 checks if the hero is underwater or not. If it's underwater, movements are reduced by 5 vertically and by 3 horizontally.

Note: I said movements are reduced, not the speed! This means that when you will pop out of the water, you have to pay attention to your speed. I want the player to move carefully when underwater, not simply have slower (easier) movements.

Now let's imagine to have some special object on the stage. If the hero collects such object will raise the score, but the entire environment will get harder.

The playing environment

A little game covering some of the thems we discussed until now.
You have to score as much as you can. As seen before, you get 1 point when you collect a coin, you lose 2 points when you hit the walls and 1 point when you hit the environment.
Easy? Not at all... I forgot to tell you the environment moves, and the higher your score, the faster the movement.

The actionscript on the first frame is

ACTIONSCRIPT:
  1. score = 0;

You may ask: can't you put this line in the hero onCLipEvent(load)?

Yes, I could, but you will see why I put it there when we will learn how to move around levels.

Anyway, in the environment object we have the actionscript:

ACTIONSCRIPT:
  1. onClipEvent (enterFrame) {
  2.     _rotation=_rotation+0.25+_root.score*0.25;
  3. }

Do you see? the environment rotation speed increases as long as your score increases. So bad!

Finally, the hero actionscript

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 0.65;
  6.     gravity = 0.1;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9.     _root.coin._x = Math.random()*400+50;
  10.     _root.coin._y = Math.random()*250+50;
  11. }
  12. onClipEvent (enterFrame) {
  13.     if (Key.isDown(Key.LEFT)) {
  14.         xspeed = xspeed-power;
  15.     }
  16.     if (Key.isDown(Key.RIGHT)) {
  17.         xspeed = xspeed+power;
  18.     }
  19.     if (Key.isDown(Key.UP)) {
  20.         yspeed = yspeed-power*upconstant;
  21.     }
  22.     if (Key.isDown(Key.DOWN)) {
  23.         yspeed = yspeed+power*upconstant;
  24.     }
  25.     xspeed = (xspeed+wind)*friction;
  26.     yspeed = yspeed+gravity;
  27.     _y = _y+yspeed;
  28.     _x = _x+xspeed;
  29.     _rotation = _rotation+xspeed;
  30.     if (_root.wall.hitTest(_x, _y, true)) {
  31.         xspeed = 0;
  32.         yspeed = 0;
  33.         _x = 50;
  34.         _y = 50;
  35.         _root.score -= 2;
  36.         if (_root.score<0) {
  37.             _root.score = 0;
  38.         }
  39.     }
  40.     if (_root.environment.hitTest(_x, _y, true)) {
  41.         xspeed = 0;
  42.         yspeed = 0;
  43.         _x = 50;
  44.         _y = 50;
  45.         _root.score -= 1;
  46.         if (_root.score<0) {
  47.             _root.score = 0;
  48.         }
  49.     }
  50.     if (_root.coin.hitTest(this.hero_hit)) {
  51.         _root.coin._x = Math.random()*400+50;
  52.         _root.coin._y = Math.random()*250+50;
  53.         _root.score++;
  54.     }
  55. }

Nothing new, just a check to the score to prevent it to be less than zero.

If you want, drop a comment with the highest score you achieved. I bet you won't easily score more than 15.

Remember to give me feedback and suggestions.

Download the examples source code and move to the 4th part

Websites of Interest: casino game

Improve the blog rating this post
Tell me what do you think about this post. I'll write better and better entries.
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.57 out of 5)
Loading ... Loading ...

» Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.

119 Responses to “Flash game creation tutorial - part 3”

  1. Vasheeth on December 6th, 2006 10:12 pm

    Hmmm… I know this is a begginer’s question to ask, and I’ll admit to being one, but how do I get two instances to group together and stay together during the “game”? I’ve tried many different ways, but they never work, I always end up leaving the square behind.

  2. Random on December 6th, 2006 10:39 pm

    This is a very good tutorial. I have one comment to make however. On your last tutorial (Part 2) you told somebody it would be hard to make a bounce effect. Its actually very easy. Start by making two separate movie clips/instances for the walls, wall1 (floor and ceiling) and wall2, the right and left walls.
    if (_root.wall.hitTest(_x, _y, true)) {
    yspeed = yspeed*-1;
    }
    if (_root.wall.hitTest(_x, _y, true)) {
    xspeed = xspeed*-1;
    }

  3. Random on December 7th, 2006 5:48 pm

    Umm… woops. Redo.
    if (_root.wall1.hitTest(_x, _y, true)) {
    yspeed = yspeed*-1;
    }
    if (_root.wall2.hitTest(_x, _y, true)) {
    xspeed = xspeed*-1;
    }

  4. Me on December 7th, 2006 10:44 pm

    Woho!
    I scored 21 :D

  5. Newbie on December 7th, 2006 11:36 pm

    i’m quite a newbie regarding flash, though i’d followed the tutorial quite easily (that’s a compliment) and managed to accomplish all the first steps but i can’t make a funcitonal score count. i’ve put the code correctly in the hero but i dont know what to do with the “score = 0;”, where to place it. (i mean, i don’t know how to initialaze a variable in the root) again, i’m new in this. sorry, hope to get ur answer

  6. Newbie on December 7th, 2006 11:51 pm

    score done.
    :)

  7. Newbie2 on December 8th, 2006 10:45 pm

    I have the same problem Newbie had, i can’t get the score to function correctly…
    I have “score = 0;” in the main frame, a dynamic text box in the main scene, and i have “_root.score ;” in the correct spot… still not sure why it isn’t responding.

  8. teh nub nub on December 8th, 2006 11:39 pm

    great tutorial
    couldnt get past 17 on that last 1

  9. Tom on December 9th, 2006 8:52 pm

    WOOHOO I SCORED 800 MILLION

  10. eblup on December 11th, 2006 12:02 am

    hey can you make one with a guy gravity ground water and boxes to hop acros.

  11. i best the game on December 12th, 2006 4:06 am

    i beat ball revamped blblblblblblblblz

  12. sam on December 22nd, 2006 6:23 pm

    i am making lives in my game it works the same way as the score but it minus lives instead of score when it hits the walls. When the lives equals 0 i tried to make a code so that it takes it to a frame which says game over

    but this code doesn’t work:

    if (_root.lives=0) {
    gotoAndStop(2);
    }
    can anyone help me???

  13. jonimator on December 23rd, 2006 4:45 am

    im having the same problem with the ’score=0′ can anyone help me?? please where do i put it??? I cant use the scoring method! :(

  14. diamonddrake on December 24th, 2006 12:00 pm

    in reply to sam:

    your code:
    if (_root.lives=0) {
    gotoAndStop(2);
    }

    correct code:
    if (_root.lives==0) {
    gotoAndStop(2);
    }

    you should be checking if lives is equal to zero,
    instead you had if, set lives set to zero.

    honest mistake, every time you use an if statement with variables use 2 quals signs. it means “is equal to”

    hope that cleared it up for you.

  15. diamonddrake on December 24th, 2006 12:04 pm

    and as for the score newbies…
    first frame, on the frame. put score=0;
    then always refrence it with _root.score
    it will work. full proof. if you can’t get it to work with that said, then go get a new hobbie.

  16. Atilla on December 25th, 2006 8:53 pm

    Hi , how can i put the ”The killing tweened environment” , but also the ”Water” ?

  17. Andrew on December 26th, 2006 12:34 am

    Nice tutorial :) hope there will be more of thees, how to make a “mario style” platform game maybe? ^^

  18. calle on December 30th, 2006 2:28 pm

    I’m not so good at this.. i could do everything exept for makeing the score board..
    so if someone could tell me how to do(from the begining please) thanks!!
    :)
    Great tutorial!!!

  19. Fiz on January 3rd, 2007 10:54 pm

    woah, totally easy to learn, and you actually explain the action script, you are gifted at tutorials, and the root files for examples are a stroke of genius

  20. Purple_Chikcen on January 6th, 2007 12:59 am

    i made a dynamic text block and gave it the instance name of score and gave put score = 0; in the actions menu of the main frame. i typed zero in it and tried the game and when i collide with the coin and walls the score does not increase or decrease what am i doing wrong can anyone help me

  21. Purple_Chikcen on January 6th, 2007 1:01 am

    “gave put” is a typo woops i didnt put the word “put” in the script lol

  22. Purple_Chikcen on January 9th, 2007 2:02 am

    wow been a while since hes replied to anyone

  23. Purple_Chikcen on January 9th, 2007 2:15 am

    yus i scored 20

  24. Ryan on January 20th, 2007 2:57 am

    I got 16 on my first try!

  25. Nabeel Quazi on January 20th, 2007 10:56 pm

    where exactly do i put the score variable thing? (the first actionscript on the page)

  26. Paul w on January 21st, 2007 4:42 pm

    i dont even get how to do the dynamic text box!?!? help!!!!!

  27. NeedHelp on January 22nd, 2007 11:23 pm

    I am having torouble with the score please help me by telling me exactly what i have to do with the score

  28. trys everything on January 28th, 2007 8:54 pm

    This is to everyone who needs help with the score box.

    Click the text tool in the tool panel and create a text box. In the properties area make sure the dropdown box is set to dynamic. In that same section you will see a text area labeled “var”. in there you type “score” because that is the name of the variable you want it to show. In the first frame of a layer (preferably the layer with the text box) enter the actionscript “score = 0;”.

    If that doesn’t work, give me some slack. Post your problems and I’ll try to help. I am only 14. :-P

  29. trys everything on January 28th, 2007 8:57 pm

    Oh yeah forgot.

    Awesome tutorial!

    Covers all actionscript problems.

    Only thing is, I want to keep all my actionscript in the first frame of a layer called “action”.

    How do I get the frame to recognize the onClipEvent (enterFrame) line for the hero MC?

  30. Mick on January 30th, 2007 7:30 am

    im having a pronlem with the scoreing, i can make the text box and everything, but i cant find the var box =(, can any1 help?

  31. confused pinguine on January 30th, 2007 5:53 pm

    This Tutorial is really great!!
    Im 12 years old and I understand(most of) it!
    But…
    when I am Playing the game ive made, evrything goes in slomotion!!!
    WHY MAAN WHYYYY!!!

  32. K on January 30th, 2007 7:28 pm

    To Mick. Mark your textbox and check the properties. Right under where you choose color and size of the letters, the “var” box is.

  33. Arne on January 30th, 2007 10:05 pm

    Help with inserting more “environments”
    Been following this guide for a while. Been going well so far. Execpt one thing. How do i add more environments? If i copy the first one i had, it simply goes right through it.

    ;)

  34. Trys Everything on January 31st, 2007 12:27 am

    @confused pinguine

    wat you have to do is increase the frames per second (fps) to 50

  35. Mick on February 1st, 2007 4:01 am

    yeah i checked there but on my flash theres no var box there…maybe i’ll just upgrade to flash 8 ;).

  36. George on February 1st, 2007 6:16 am

    i dont know if this was answered somewhere but alot of people were asking about the scoring. make a dynamic text box, give it a name then type this into action script.

    _root.(text box name).text = “score: ” (variable name for score);

    hope it helps

    =\

  37. helper monkey on February 2nd, 2007 6:21 pm

    – confused pengiun, just click on the stage, then open the properties bar at the bottom, there should be a box that says “FPS 12″, simply change the 12 to a higher number.
    im using flash mx 6.0, so sry if you’re using a different version and this doesnt work

  38. im the best on February 4th, 2007 7:56 am

    emanuele i mastered that spinning game i got 17!

  39. im the best on February 4th, 2007 8:02 am

    Lol vasheeth you spelt beginner wrong

  40. im the best on February 4th, 2007 8:07 am

    and mick flash 8, it rocks i suggest going for it

  41. confused pinguine on February 9th, 2007 10:30 pm

    thx 4 ur help Helper monkey and trys everything!
    I appriciate it man…
    /\
    (or however u spell it…)

  42. Anonymous on February 10th, 2007 7:22 pm

    Great tutorial, bad for beginner because you don’t explain very much.

  43. Glucozade (Sonic fan #1) on February 14th, 2007 12:07 am

    how would i put in a variable showing the number of lives left and ‘game over’ -ing the game when the lives reach zero?
    any help is appreciated

  44. -none- on February 16th, 2007 7:47 pm

    23 point!!!!!!!!
    beat that!!!

  45. Bubbler on February 18th, 2007 3:43 pm

    In response to diamond drake:

    your code:
    if (_root.lives==0) {
    gotoAndStop(2);
    }

    correct code:
    if (_root.lives==0) {
    _root.gotoAndStop(2);
    }

  46. Trevor on March 15th, 2007 7:54 pm

    im creating a trigger similer to the one used in the tutorial but i want to be able to stop and start the moving block the trigger affects effects I’m a complete begginner with flash but learning fast, any help you can give me is greatly apreciated.

  47. Pit on March 17th, 2007 3:12 am

    Man, i can’t figure out the score thing either…i know im doin somethin wrong. if only i knew what… I put the score code in the frame, i make a dynamic text box with variable of score, and i put in the code in the hero. NOT WORKIN! When i veiw the movie, the score box doesn’t even start out with a zero in it!

  48. Pit on March 17th, 2007 3:13 am

    oops, i meant instance! lol not variable

  49. Chris on April 5th, 2007 7:44 am

    Hey i’m currently making a game (not like yours, but similar. and i was wondering, if theres a code, so that when the “hereo” touches a movie clip, it goes to the next scene?

  50. Jonny on April 6th, 2007 1:01 pm

    Hi im all new to this actionscript stuff and so im confused. this is probably a really obvious answer but on the last game when i try to make the environment rotate, it doesn’t rotate from the middle, it always rotates from the left. can anyone help with this please?

  51. ru8ikscu8er on May 9th, 2007 6:50 am

    Yay, after about an hour of mindlessly playing this game like a moron, I have finally achieved the coveted rank of 30, thus becoming the world class mindless game player

    P.S. I can do the rubik’s cube in about 30 secs

  52. Chaos on May 10th, 2007 5:14 am

    So, I’ve read through the tutorials and I think they are pretty awesome. I’ve been tweaking numbers within the games, and I’ve noticed that I’m unable to make a solid object. I’ve been trying to make a solid ground or block that doesn’t kill the player, the player just can’t go through it. Mostly, I’ve been trying this with the ground. I’ve change the settings so that it doesn’t kill the player (commented out the change x and y positions) and I’ve changed the part where it changes the players speed, so rather than setting it to 0, it sets it to -(some number)*xspeed. Is there a specific number that I have to use that counters gravity and the player’s downward force? Like, for example, should I stop the players motion, than give them a gentle push upward?

  53. Smokey on May 16th, 2007 1:41 am

    im a little confused.

    The score

    Scoring system consist in a variable set to 0 (zero) when the game starts and some events that may increase/decrease the score.

    In this case, you get 1 point when you collect a coin, and lose 2 points when you crash into a wall.

    Hall I have to do is initializing a variable in the root with a single action
    ACTIONSCRIPT:

    1.
    score = 0;

    Where do i write the “score=0;” ?

  54. shadowt on June 5th, 2007 6:55 pm

    im a little confused.

    The score

    Scoring system consist in a variable set to 0 (zero) when the game starts and some events that may increase/decrease the score.

    In this case, you get 1 point when you collect a coin, and lose 2 points when you crash into a wall.

    Hall I have to do is initializing a variable in the root with a single action
    ACTIONSCRIPT:

    1.
    score = 0;

    Where do i write the “score=0;” ?

  55. MasterZ87 on June 7th, 2007 3:55 am

    Score 14 xD

    I know somethinks abouts programming (Div