ForumsProgramming Forumi need some help with game making

8 3307
Midmenj
offline
Midmenj
216 posts
Nomad

ok so all i know in programming is button and how to stop a animation. yes i know simple. I would like to know how to make it so if the character touches something they go to the next frame. Also how to make it so id they are standing on a platform if they fall they lose HP. any help would be appreciated.
Thanks

  • 8 Replies
Midmenj
offline
Midmenj
216 posts
Nomad

and its for 2.0 for actionscript for flash

jpx111
offline
jpx111
264 posts
Nomad

for the "if the character touches something it takes him to another screen" scenario, you need to use 'hittest' function to figure out if he/she touched it and then 'gotoAndPlay' to take him/her to another screen.

the second one could also be done with 'hittest' feature. you could make it so that if the 'hittest' is true, do nothing to his health, but if false, reduce the hp

Captain_J_Sheridan
offline
Captain_J_Sheridan
313 posts
Nomad

if (character.hitTest(Something))
{
gotoAndPlay( Your next frame );
}


It could also be gotoAndStop depending on what you want

Maybe you could just do an else for the hp loss

if (character.hitTest(Platform))
{
trace("yay&quot
}
else
{
HP = HP - 1;
}
Midmenj
offline
Midmenj
216 posts
Nomad

where do incert the first and second code?

i tried in the fram, in the door and in the chracter and it didnt work...

Captain_J_Sheridan
offline
Captain_J_Sheridan
313 posts
Nomad

You have to learn about loopings, like function() and etc

How did you make you character move?

jpx111
offline
jpx111
264 posts
Nomad

it most probably did not work because you did not give it correct instance names. if you just copied and pasted the code Captian_J_Sheridan provided, you need to make some changes to instance names.

In the first code, "Something" should be the instance name for your wall movieclip. You could have another instance name, but you have to replace both the code and the movie clip with it.
And, "Your next frame" should be replaced by the frame label. A frame can be given a label or name using the bottom toolbar in flash. Also, the frame label has to be in double qoutes when you enter it in the script

For the second code he provided, the platform the character stands on should be given the instance of "Platform". And you should already have a HP counter/bar in place. And, the movieclip your character is in should be called "Character"

Hope this helps

Drovosek
offline
Drovosek
57 posts
Nomad

i hope too

noobgai
offline
noobgai
12 posts
Nomad

or, it its a mouse game, on the oject that you touch, put this script:

[code]on(rollover){
gotoAndPlay(the frame you want it to go to)
}

Showing 1-8 of 8