0 Favourites

Cannon mechanics

  • I've been experimenting with various setups for a relatively simple game based on a circus cannon. I'm still having issues with some elements outlined below. Any ideas how to resolve them

    Here's the file:

    circus cannon test

    Ideally:

    1. As mouse button is pressed, energy increases to a max of 100 (done)

    2. Cannon stops when mouse button is released

    3. Object shoots out in the direction the cannon was aimed, at the speed set by the energy (no luck with this yet)

    5. ScrollTo follows object (somewhat done - but I'd like it to follow and not dissapear once it reaches uper border of screen)

    6. Object is affected by gravity (physics work, but when button is pressed, the object gets lifted up)

    7. Pass control from cannon to flying object. In other words, stop the creation of additional fired objects and instead give "lift" to the currently flying object.

    Next steps:

    Create a visual "flight bar" that gives air push to the object when mouse/touch is pressed, but decreases in value.

    What I have at the moment is not very elegant. Any ways to optimize the logic would be appreciated.

    Thanks for the help.

  • have the cannon ball shoot by applying a force toward a position*power and then and set unbounded scrolling to no and change the layout so it will work

  • Thanks sosensible. I think there's something similar already in place in terms of power and position. Unbounded scrolling is set to no. Actually, it works better when set to yes, but that also wrecks the overall layout.

    The fired object keeps shooting upwards rather than in the trajectory the cannon is aiming at.

    I need also to limit it so that once the object is fired, no more objects can be fired.

    Suggestions?

    Thanks.

  • flaye

    It is cool but how it work on touch event i Changed mouse event into touch but after that it didn't work properly..... so Any Idea

  • flaye, trying to answer point 3.

    Set angle of object being fired to that of angle of cannon.

    Use bullet behaviour on object and in properties keep "set angle" at yes.

    This should get the angle correctly set on creation.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Sorry for delay in replying. Life kinda got in the way

    @rob: not sure why it's not working. It is in mine.

    @AngelEyes: Thanks for the tip. Worked!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
33 2,469
Sargas's avatar
Sargas
Topic
0 Favourites
Match-3 mechanics
24 2,487
ShadeKirby500's avatar
ShadeKirby500
Topic
0 Favourites
Click and Drag Mechanic
21 2,965
droptank21's avatar
droptank21