The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.

ForumsProgramming ForumPlatform Game.

4 3614
Midmenj
offline
Midmenj
216 posts
Nomad

Hello, I am making a platform game. I have little to no experience with flash. I have my game made in Game Maker but I can't get it to go on Armor Games because it's not a flash file. So i'm going to make it in flash. This means I need help with coding. I want to make it in AS 2.0 also. I would like to learn the codes for:

Movement: arrow keys (left and right to move left and right obviously)
Jump: which will be the up arrow
Gravity: to keep the player down on the ground
Hit_test: I'd like to learn most hit_test codes like for attacking enemies and enemies attacking you, also when i hit the door i go to the next level and the hit_test for floors and walls.

That's all I want to learn right now, and health but that may come with saying for the enemies part.

Thanks if anyone can help me.

  • 4 Replies
plasmafish
offline
plasmafish
252 posts
Nomad

You can check out this file, it is quite simple but has everything you are asking for.

http://3dmitchell.com/freeDL/gametutFLASH8.fla

master565
offline
master565
4,104 posts
Nomad

i can tell you 2 things

hit test is

if (exampleOne.hitTestObject(example2)) {
trace("worked"
}

and one way to simulate gravity is

var square:MovieClip = new box()

addChild(square)
square.x = 50;
square.y = 200;

var squareVel:Number = -15;
var squareAcc:Number = .5;

addEventListener(Event.ENTER_FRAME, gravity, false, 0, true)

function gravity(e:Event)
{
square.y += squareVel;
squareVel += squareAcc;
}

and how that gravity works is that the objects Y keeps increasing by a number (squareVel) and that number keeps being decresed by another number (squareAcc) which slows the squares rise until it hits a negative number which will reverse its direction and make it go down. This can also be used to simulate drag and elasticity.

master565
offline
master565
4,104 posts
Nomad

also a better way to ask questions that you want actual code for go here
http://stackoverflow.com/

ahmadovski
offline
ahmadovski
2 posts
Nomad

I agree

Showing 1-4 of 4