I am making a game with artificial intelligence zombies, and have all of the direction and walking programmed. But the problem is that it is a platformer and the zombies can walk through walls. This wouldn't be a problem if I only had one, but I have lots. Too many to program individual sensors for each one. How can I make lots of zombies that can't walk through walls without me having to program each one's sensors?
Offline
Sensor costumes could work. It's like a sensor sprite, but a costume that your sprite switches to and acts as a sensor. Say you make an extra costume that's just a dot (with it's rotation sensor placed such that the sprite is on the right side of your main costume) You can add into your main script:
switch to costume [right sensor]
if touching [wall]
Set RightTest to 1
else
Set RightTest to 0
switch to costume [main costume]
*Note: Your main costume won't be affected and you won't see the sensor.
If you're using color sensing, you can have just one sensing costume with four colors on each side.
Last edited by Kileymeister (2011-05-08 20:34:56)
Offline
Kileymeister wrote:
Sensor costumes could work. It's like a sensor sprite, but a costume that your sprite switches to and acts as a sensor. Say you make an extra costume that's just a dot (with it's rotation sensor placed such that the sprite is on the right side of your main costume) You can add into your main script:
switch to costume [right sensor]
if touching [wall]
Set RightTest to 1
else
Set RightTest to 0
switch to costume [main costume]
*Note: Your main costume won't be affected and you won't see the sensor.
If you're using color sensing, you can have just one sensing costume with four colors on each side.
Thanks! I'll try that.
Offline
Kileymeister wrote:
Sensor costumes could work. It's like a sensor sprite, but a costume that your sprite switches to and acts as a sensor. Say you make an extra costume that's just a dot (with it's rotation sensor placed such that the sprite is on the right side of your main costume) You can add into your main script:
switch to costume [right sensor]
if touching [wall]
Set RightTest to 1
else
Set RightTest to 0
switch to costume [main costume]
*Note: Your main costume won't be affected and you won't see the sensor.
If you're using color sensing, you can have just one sensing costume with four colors on each side.
This doesn't seem to work. For one, the zombies have walking animations, and two it puts the right and left variables to one, even when the sensors aren't touching the wall.
Offline