Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am developing game like galaxian and using cocos2d with box2d .I don't have idea how to create enemies like galaxian game enemies and how do they fly over the screen. http://www.youtube.com/watch?v=BmrCd5tPqpo&feature=related

Could you please help me how to do this ?

I have created the enemies but when i look at the game enemies fly how they are flying ?

share|improve this question
    
What movement are you trying to recreate? What have you tried? –  Ricket Oct 7 '12 at 7:17
3  
Maybe just Google space invaders tutorial, for any language. I'm sure the movement algorithm will be discussed. Your question as is doesn't give anyone much to work with. Remember, you want to make your question as easy as possible to answer. So give us all the information we'd need. Like what you've tried already and what about it didn't work. Also, work on that accept rate, 30% is low. –  Byte56 Oct 7 '12 at 7:28
    
I have created the enemies but when i look at the game enemies fly how they are flying ? –  jubin Oct 7 '12 at 7:40
2  
@jubin their X and Y coordinates change. –  Markus von Broady Oct 7 '12 at 7:44
1  
To make them fly curves take a loot at Bézier curves: en.wikipedia.org/wiki/B%C3%A9zier_curve –  bryan226 Oct 7 '12 at 10:22
show 1 more comment

1 Answer

Initialise and assign a movement function to each enemy as a function of time for e.g.

x(t) = 5 * sin(t)
y(t) = t * 0.2

final position = Point(x(t), y(t))

when they start flying, plug in the game elasped time since start of flight into x(t) and y(t) to give you the new X and Y coordinate of the enemy.

A boss movement function could be e.g.

x(t) = 10 * sin(0.2 * t)
y(t) = cos(0.2 * t)

NOTE: depending on the coordinate system of your game, you may need negative functions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.