Jump to content


Photo

A problem with shooting enemy


  • Please log in to reply
4 replies to this topic

#1 Gral92

Gral92

    GMC Member

  • GMC Member
  • 34 posts

Posted 29 April 2012 - 06:17 PM

Hi there.

I'm making a platformer and I've ran into a weird bug. I have an enemy which behaves pretty much like Mets from Megaman series. Once the player gets close, it opens up for attacks and fires 3 bullets.

The problem I have is, sometimes they won't fire at all. Few instances of the enemy will just open up and take damage once I get close, but will never fire at me. There is one specific instance that fires when I'm playing, but if I reach the first checkpoint, die and respawn there, it will not fire at me.

Anyway, before I give any code, is there any way to check if the bullets are even being created? I mean, they are either not being fired at all or they destroy themselves upon creation and knowing which is it, may help me find the bug

Either way, I don't think it matters because it does work for some enemies and not for others.

Enemy firing the bullet action and changing sprite action are both in the same block, and animation plays, so bullets should be fired as well.

But bullets get automatically deleted when they are too far from the player. For the enemies that don't shoot, I'm sure the player is not far enough to make them go away. It's the same distance for pretty much all enemies and works for few, and doesn't for some others

Edited by Gral92, 29 April 2012 - 06:22 PM.

  • 0

#2 jo-thijs

jo-thijs

    GMC Member

  • GMC Member
  • 2838 posts
  • Version:GM8.1

Posted 29 April 2012 - 06:20 PM

you can put in the create event or the destroy event: show_message("The bullets have been created.");
for further help I need more code.
  • 0

#3 Gral92

Gral92

    GMC Member

  • GMC Member
  • 34 posts

Posted 29 April 2012 - 06:24 PM

One question before I continue searching for the bug

If the Step Event for bullet looks like this:

if !((abs(x-Player.x)<176)&&(abs(y-Player.y)<136))
instance_destroy();

"x" and "y" mean the bullet's coordinates, yes? If they mean something completely different, that may be it.

Edited by Gral92, 29 April 2012 - 06:25 PM.

  • 0

#4 jo-thijs

jo-thijs

    GMC Member

  • GMC Member
  • 2838 posts
  • Version:GM8.1

Posted 29 April 2012 - 06:27 PM

They mean the bullet coordinates indeed.
  • 0

#5 Gral92

Gral92

    GMC Member

  • GMC Member
  • 34 posts

Posted 29 April 2012 - 06:30 PM

They mean the bullet coordinates indeed.


Then... I have no idea.

I made it play a sound in Create event in Bullet object and it does play when I come close to the enemy. So they disappear instantly even though the player is close enough :<

I guess I'll just have to see if I didn't make some other way for them to disappear.

Edit: I commented out the whole destruction thing and they still don't appear so yeah, must be something else that makes them go away, I can handle this myself from here, thanks

Edited by Gral92, 29 April 2012 - 06:32 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users