Public Group

# Makeing a flash game, need help

This topic is 5175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, i am a student learning multimedia design and i am currently working on a flash game for a project. my aim is to succesfully make a beat-em-up similar to Ninja turtles, double dragon, etc. most of it is done, all my sprites and backgrounds are finished i have managed to succesfully program in the walking limitations and scrolling background, although the most trouble i am having it coding the enemies to not only move left and right, but up and down as well, i am stressing this very much. if anybody can point me to a site that explains how to do so, or a tutorial, or source file, or conteact me. i am desperate. any help would be greatly appreciated, thank you :)

##### Share on other sites
what exactly is your problem in getting them to move up and down? This is a very specific topic and I doubt that there are any resources available that directly address it.

perhaps if you posted a little bit more detail as to what the problem actually is someone would have better luck giving you a more detailed tip [smile]

I'll try to do my best with the information I have:

I'm assuming that you're storing enemy positions as well as their width and height, in order to make sure they don't go off the screen you are checking the x position as well as the x position + the width of the enemy. In order to keep the enemy from going off the bottom you should use the y position + the height to determine where their 'feet' are. Once this is done set a high/low boundary for the feet and enforce it just like the left/right boundary.

##### Share on other sites
ok here is a picture,

my goal is to make that guy on teh right, automaticaly move closer to the hero on teh left as a steady pace. and stop when hes not so far away. and later figure out how to exchange damage

##### Share on other sites
Since you are a multimedia student I suggest you not to indulge in complex maths of programming physics algos right now but look at simpler codes of flash tuts/games instead at www.flashkit.com

##### Share on other sites
too late, i nee this thing done by friday, and thats why im desperate, i dont think i have to deal with anything "too" complicating, i need to find a way to just make "bad_guy" walk to "good_guy" thats it

##### Share on other sites
I dont see how making the enemies move closer vertically to the player is anymore difficult than making them move closer horizontally?

if the enemy is higher than the player, move down.
if the enemy is lower than the player, move up.
if the enemy is left of the player, move right.
if the enemy is right of the player, move left.

That's pretty much it unless you were after some more complex form of the enemy determining their path

##### Share on other sites
what you can do first of all i hope that you have save both x and y position of the bad guy and the hero as well then waht you need to do is

And you would do the same thing for the Y but this Time keeping track of the Height of the Screen in mind. Hope that helps

##### Share on other sites
this is how I have done it.

"temp" = the enemy

/////////////////////////////////////////////////////////////////////////////////////////////This Part is for distance//////////////////////////////////////////////////////////////////////////////////////		xdistance = player._x - temp._x;		ydistance = player._y - temp._y;			var distance = Math.sqrt((xdistance * xdistance)+(ydistance * ydistance));				if (distance < 50)			{				//enemy/player hitting code			}			//stun will toggle when enemy is hit by player lazer		if (stun == 1)		{			/////////////////////////////////////////////////////////////////////////////////////////////This Part is for rotation//////////////////////////////////////////////////////////////////////////////////////			TanY = gold1._y - temp._y;			TanX = gold1._x - temp._x;			temp._rotation = Math.round((Math.atan2(TanY,TanX) * 180/Math.PI + 90));		/////////////////////////////////////////////////////////////////////////////////////////////This Part is for movement//////////////////////////////////////////////////////////////////////////////////////			var x = temp._x + Math.round((Math.sin(Math.PI/180.0 * temp._rotation)) * enemyspeed);  			var y = temp._y - Math.round((Math.cos(Math.PI/180.0 * temp._rotation)) * enemyspeed); 			temp._x = x;			temp._y = y;		}

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 11
• 9
• 24
• 52