Returning Bullets

This forum is currently in read-only mode.
  • I'm glad I found this program. I've been fiddling around with all sorts of things for years and never really found a good outlet for my game ideas. I like that it's easy to pick up and figure out how things work simply by fidgeting with them. That said, I've got a snag.

    I'm making a platform game where a person, equipped with a bat, can hit projectiles to prevent being hurt by them. Deflecting them away is easy enough, but I'd like to be able to return the bullet to the enemy that spawned it, which will in turn destroy it, and I'm not too sure how. Playing with the bullet behavior, I found if I rotated it 180 degrees it would fly in the opposite direction. But with moving targets, it'd be pretty difficult to hit anything that way. I can make the bullet home in on the player by telling it to look at her, but trying to do the same to the enemy will make it aim at the nearest instance of the enemy rather than the one that shot it. Is there a way to be more selective of which instance the bullet will look at?

    Thanks for reading and in advance for the help.

  • There are a couple ways to do that. Since your already using the bullet behavior I would do an on collision event when you want the bullet to return just use the action rotate toward object, with the amount of rotation set pretty low.

  • Yes I've tried that, but like I said, when there's more than one instance of the same enemy, the bullet will rotate toward the one closest to it, not necessarily the one that spawned it. Unless I'm missing something here...

  • You can have the bullet remember UID of its shooter and have it turn toward the enemy matching that UID.

  • Heh was just going to say the same thing.

    Any way use a private variable, and make the pv the uid of the shooter.

    Here's an example.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah I think I understand. Thank you, I'll try it out.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)