How do I throw objects in 4 directions with power meter?

0 favourites
  • 6 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • A bit of a specific, and big question...

    Top down Rpg, I'd like to throw an object like a bomb in 4 directions... the longer you hold down the button the further the throw. Represented by a power meter.

    Not sure if there are any specific examples, so it would be useful if I could get a workflow:

    1. Hold down button/key

    2. Start bomb-throw-timer

    3. Power meter Y scale increases (linked to time? If time = 3 seconds, Y scale = 300px?)

    4. Let go of button

    5. Stop bomb-throw timer

    6. If timer = 3 seconds, distance = 300px etc?

    7. Spawn bullet with distance set

    8. Reset bomb-throw-timer

    Does that make sense of is there a more efficient way to do it?

    It would be good to show an arc when thrown too (particularly when thrown on the X axis). Though this could be animated in the frames I guess?

    Thanks for any tips.

  • Sounds like a pretty well laid out approach. Are you wanting to use physics? impulse is pretty easy to work with and it is pretty easy to control what direction you want the impulse to go.. i'd start there if you haven't already.

  • Thanks for the advice. I'm completely new to all this so haven't even heard of impulse, or used physics for that matter...

    I'll keep digging. I'd like to make the game as efficient as possible from the very start.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea it's not bad.. a few tips to get started with physics..

    1. at start of layout on a given physics object "set world gravity to 0. this will keep things from "falling" off the screen in a downward direction which is the default.

    2. the object you want to "throw" any direction needs to have physics added to it. this will open up a slew of impulse options in that object.

    3. any object you want to stop the thrown object needs to have "solid" behavior added to it

    from there it's mostly experimenting. there are physics properties like friction which can help keep the object from sliding to far..

    It will take some tinkering to get it right, no simple way to do what you want without a little practice with construct, but this should get you in the right direction.

    good luck!

  • Wow so i've been trying this on and off all day without success...

    Does anyone have an example please of controlling the bullet distance by holding down a button, or even using a meter where you click to start, then click again to end?

    I'm finding it far more difficult than I thought :)

  • I believe there is an angry birds type example on the start page.

    Edit: editor.construct.net

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