Makeing a flash game, need help

Started by
6 comments, last by Justaddwater 18 years, 8 months ago
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 :)
Advertisement
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.
ok here is a picture, Image hosted by Photobucket.com

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
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
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
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
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

if(badguy_x>(hero_x+hero_w) And badguy_x<Screewidth)badguy_x=badguy_x-1 endif
if(badguy_x<(hero_x-hero_w) And badguy_x>0)badguy_x=badguy_x+1 endif

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
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;		}

This topic is closed to new replies.

Advertisement