The Daily Click ::. Forums ::. Klik Coding Help ::. my enemy movements suck

Post Reply  Post Oekaki 

Posted By Message


3rd January, 2007 at 18:24:31 -

Hope somebody can help me with this.

I'm making a Time Pilot / Bosconian type of game: it's a kind of space shooter where your guy sits immobile in the center of the screen and rotates, while all the stars move around him, giving the impression that he's flying through space.

Anyhow, the problem is this.

To my surprise (I'm new at this), I successfully designed the engine that rotates the ship and moves the stars and everything.

The problem I'm having is this: my enemies are dead, boring lumps of nothing.

I have no idea how to code the enemies in this situation, to fly about the player's ship.

I can either

a) get them to sit there
b) get them to fly down the screen, without paying attention to the player, or
c) make a dead beeline for the player

None of which will do.

Does anybody know how I can code it so that the enemy ships kind of circle about the player menacingly without making a direct kamikaze run for him?




Mascot Maniac


Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
3rd January, 2007 at 20:25:46 -

First of all think of what you want the enemies do do exactly.
Then use the even editor to manipulate their X or Y coodinates.

There are probably boomerang tutorials that can help you, just change the boomerang from a weapon to an enemy and you have a start.



I'm on here way too much


You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
4th January, 2007 at 06:37:13 -

If you want your enemies to move in set locations, you can make them collide with (invisible) detectors - and on collision telling the ships where to go and how fast. Course, you want to ensure that your ships' direction is always facing that of your position.

You could also set x and y to variables, and +1 and -1 from each every however many seconds.. Or I suppose you could even give them 'ball movement' and make them bounce randomly off of the edges of the screen!

I think ball movement would be rather cool Though I'm not sure if you can fire at a player with that?! You should be able to though - I've just never tried. Using the ball movement, the ships can go at various speeds and bounce of various places and random vertices, and you could tweak the movement in places so they look like they are randomly flying around your perimeter rather than bouncing off of the edge of the screen

That'd be my plan until someone comes up with something less retarded-sounding anyway. Boomerang style would be funny Hope that helps..

Destroyer (CrobaSoft)

4th January, 2007 at 09:57:57 -

Do you mean something like this? I could send you the source if you want.

Visit or you're a Noob.




Game of the Week WinnerYou've Been Circy'd!
4th January, 2007 at 14:16:26 -

A simple way to make them circle around you is to give them a ball movement, and then do this:

* Always
- Enemy: Look in direction of "Player"
- Enemy: Set direction to dir("Enemy") - 8

If you do dir("Enemy") - 7 they'll slowly spiral inwards, towards the player. Dir("Enemy") - 9 will make them spiral outwards, away from the player. Then just go from there, play around with it.

You can always have many different kinds of enemies, with different movement and attack patterns. For instance, you could have one enemy that circles around the player for a few seconds, shoots stuff and then leaves, or an enemy that just flies kamikaze straight into the player, or an enemy that just flies by randomly (Enemy: Set direction to dir("enemy") + Random(3) - 1) and shoots stuff.

Example file:

Image Edited by the Author.



9th February, 2007 at 05:17:04 -

Thank you very much all (especially Axel and Destroyer for those files). They helped a lot.


Post Reply



Worth A Click