How do i aim..

0 favourites
  • 4 posts
  • Hi, i want the block to stay STILL when i click and hold on it. And i want it to Shoot towards where i have my cursor. As you can see, it just jumps and bobs about whenever i click and WHEREVER i click. i don't even have to click ON the Block, it still moves.

    Depending on how far away my cursor is from the block when i LET GO of the click, is how far i want the block to shoot.

    So, 1) How do i "Aim" the block without the block moving when i click on it.

    2) How do i set it so the distance of the cursor from the block is how powerful the throw is.

    3) how do i Stop the block from moving when i click anywhere.

    GIF of problem:

    Image of my current event list.

    i have no idea what i'm doing.

    You could say it is similar to "angry birds" but i don't want the catapult Mechanic and i Can't figure out how to do what i want it to do by looking at the Event List for the Catapult Physics template game.

    Any help is appreciated. I will be going to work for 8 hours now, so i may reply when i get home.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could always make a sprite that looks like your player but has no physics behavior attached. It simply shows a visual of what you want when the player sets power (ie. by looking at mouse but staying put). You would then just need to destroy fake, spawn real and apply your data to it on creation that you stored in variables.

    It sounds like from your description though you might be looking more for an arrow and less catapult type launching...

    Look at this .capx and see if it helps. It uses a delta time velocity increase based on mouse button down but you could change the formula to calculate distance cursor is from the player as well.!ApREGYJdm9zRgTg22-eF6bRHhSpp

  • ok, thank you, i think you may have just given me a new mechanic for my game! lol

    but it all looks very complicated. Could i please ask that you give me a breakdown of what each of the different variables are?

    like xhand and yhand and stuff?

    I'd be very grateful.

  • Those are just used to store where the archers "hands" are... they are simply the X and Y coordinates so the arrow knows where it should be.

    They currently set it to the player sprites X and y-32 so it appears somewhat where the hands would be...

    They are just storing a place in X,Y space...

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