The McLeodGaming forums were permanently closed on April 30th, 2020. You are currently viewing a read-only archive.
View unanswered posts | View active topics It is currently Fri May 15, 2020 5:38 am

Forum rules


IMPORTANT

This Forum is for Flash related questions ONLY! Do not ask questions about spriting, Game Maker, Photoshop, or anything else not related to Flash.



 [ 1 post ] 
[Request] Hit test with all objects but .this 
Author Message

Joined: Wed Sep 09, 2009 6:01 am
Posts: 1
Gender: Anime Girl
Hello,
I've been scripting a flash game in AS2 with a similar theme to CoD's "zombies".
My problem is with the zombies themselves, I'm at my wits end trying to figure out a way to make sure they can't pass through each other as though they are solid objects.
I have been able to do the above with the player by using the following code:
Code:
function hit_test() {
   while (_root.player.hitTest(this._x, this._y+radius, true)) {
      this._y--;
   }
   while (_root.player.hitTest(this._x, this._y-radius, true)) {
      this._y++;
   }
   while (_root.player.hitTest(this._x-radius, this._y, true)) {
      this._x++;
   }
   while (_root.player.hitTest(this._x+radius, this._y, true)) {
      this._x--;
   }

I'm spawning the zombies as follows (where k increases each time a zombie spawns.)
Code:
ground.creeps.attachMovie("Zombie", "Zombie"+k, ground.creeps.getNextHighestDepth(), {_x:250, _y:200});


Is there a way I can do a hit test with all objects but the current one? Please help!


Wed Sep 09, 2009 6:27 am
Display posts from previous:  Sort by  
 [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.