Collision Query [Please help!]

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi there everyone, I've just started using Construct 2, and as an animator who's dreamed of making games but been horrified of syntax and big scary computer things; it's quite literally a dream come true.

    Gushing aside, I've been slowly chipping away at making a top down shooter, and I'm having trouble making one of the weapons work the way I want; basically it's a top hat that when thrown can bounce off of enemies and walls, doing damage as it goes (Think Oddjob from James Bond!) Thanks to the bounce bullet command, this is easy!

    The trouble comes when I try and complicate the weapon, I'd like it so that if the player was able to direct the hat in such a way that it bounce back and hit the player, they would regain ammo and be able to do it again (As well as net a puntastic Hatarang achievement): By adding a collision event between player and bullet in which this would occur, I've broken my attempt, as the bullet is instantly destroyed upon spawning.

    Any suggesstions? I was thinking of making it spawn on player.x +5, player.y +5, but I can't work out a way to implement that in the event sheet; I'm probably being dumb! Another way I think might work would be if I had a variable that incremented every time the bullet and player collided, and if the value was even, then the bullet would be destroyed: No real idea how to do that...

    Please ignore what I imagine is awful C2 etiquette/programming, I'm not that way inclined unfortunately!

    tl;dr: How do I stop a collision event between player and bullet on the initial event?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What you want to do is register the first non player hit

    This way, if the hat already hit something and it hit the player it can be destroyed.

  • Here is a capx showing how to have a player object throw another object, have it bounce off a wall, and then catch it. It just uses an instance variable in the thrown object.

  • That makes all kinds of sense, thanks guys!

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