Be a Supporter!

AS2 Collision Question

  • 217 Views
  • 1 Reply
New Topic Respond to this Topic
CyberXR
CyberXR
  • Member since: Aug. 22, 2008
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
AS2 Collision Question 2011-03-04 11:22:24 Reply

Hello!

My question will be much easier to explain with a little sample of my game:
http://www.newgrounds.com/dump/item/6839 bbe7ecde21cfc730320cb080a139
(you walk with W A S D)

I was wondering is there is a simple way to make the enemies (the red little blobs) to move if you walk thowards them. Right now the player walks OVER the enemies, which is not what I want. I would like the enemies to get pushed back if the green Player with helmet walks towards them and collide. I was thinking about some idéas but non of them work.

Is it any simple way?


Check out the coolest Donkey Kong Game on NG!
http://www.newgrounds.com/portal/vi ew/459064
100 posts @ Posted at: 9/15/08 07:36 AM http://www.newgrounds.com/bbs/topic /969232

Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to AS2 Collision Question 2011-03-04 11:34:28 Reply

Just give a look in your game. Are only angles, trigonometry. Looks like you're copy and pasting codes from some tutorial because the only thing you need is just what you're doing with all the other things. Just invert the angle, you can use *-1 to it. Moving towards them is just measuring to get same angle both in x and y.