The Daily Click ::. Forums ::. Klik Coding Help ::. Pushing enemies...
 

Post Reply  Post Oekaki 
 

Posted By Message

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
17th March, 2008 at 18:53:35 -

Ok, heres a problem I have. In my game, you can push enemies with a shield. I use alterable values and XY coordinates to do it. However, this makes them prone to getting stuck in walls, or going through them.

My enemies function as bouncing ball objects, with no randomizer/security and they move by saying "Every 1 sec, add 4 to dir."


So, how can I fix this? I tried saying "If overlap background, put value A - something, but it doesnt work.

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
18th March, 2008 at 08:26:26 -

I believe they are getting stuck because you are relying on the in-built ball-movement collisions to work, yet you are affecting their co-ordinates to push them, which is getting them stuck.

The easiest way to fix this is to probably change the pushing code to: Make enemy look at player; Set enemy's direction to it's current direction + 16
Therefore, the enemy will end up going in the opposite direction to you when you push it.

I am assuming this is a top-view game btw.

 
n/a

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
19th March, 2008 at 19:37:53 -

It works, but is there a way to push him back further? Like, I want the push to be a larger force.

 
n/a

SoldjahBoy



Registered
  25/10/2006
Points
  100
26th March, 2008 at 01:40:55 -


Originally Posted by Devernath
It works, but is there a way to push him back further? Like, I want the push to be a larger force.



when you collide with the enemy, just set thier speed a little higher and they should go further back... assuming you have some deceleration for the "ball movement" you could also set that lower and they would again move further.

 
What's wrong with pillow shading? O.o
   

Post Reply



 



Advertisement

Worth A Click