Thrown Object

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I've run into a couple of snags with a system I'm trying to put in place. Instead of using a generic bullet object, I would like my platform player to replicate throwing a physics object (ie a grenade). I've tried a couple of different things and I feel like I'm close to nailing it but there's always something that I can't get down.

    I tried just a simple "KEY IS DOWN: LEFT ARROW" and then adding force to the physics object. This looked great initially but once the player has let it fly and it's landed and settled on the ground, anytime the left key is pressed it will move again. It also means the player is forced to move if he wants to throw which is clumsy.

    I can't really figure out a way to detect which direction the platform object is facing in order to use that as a guide point. There is "Compare Angle" but the platform object at the moment is just a single sprite box and even when I make a second sprite for the 180 angle it doesn't seem to make a difference.

    Anyway I'm pretty stumped in regards to this now. If anybody has any suggestions I'd really appreciate it, thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For most things having a single box sprite like you do for your platforming object is best, but it's also good to know when to break the rules

    If you make a 180 angle for your platform object, then you can detect which direction it's facing. Just make sure the hotspot and size of the sprite are exactly the same as your 0 angle. In fact, you can just copy the whole frame over by selecting the 0 angle's frame with C and then pasting it into the 180 angle's animation with V (not Ctrl-C and Ctrl-V for some reason ).

    Also, are you intending to have player control over the actual thrown object, or do you want to just wind up and let it go do it's own thing? If you want it to behave more like an actual thrown object without any further input from the player then you'll need to gather all the speed/force/angle data that you'll need prior to spawning the grenade and once it's spawned the rest needs to be totally automated. The Ball behavior might work for you in this case. Set all of it's information in the same action that it's spawned in. That's all the amount of player input it should get from that point on.

    I'd work up an example for you but I just reformatted my hard drive earlier so my computer doesn't have Construct on it yet

  • Okay, here's that example:

    Press Ctrl to spawn a ball. The ball's angle and speed is dependent on the direction and speed of the player at the time it's thrown. It uses the Ball behavior, and probably doesn't do exactly what you need but it should give you an idea where to go from there.

  • This helps a lot, thanks man.

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