Increasing Projectile Speed Every X Millseconds

This forum is currently in read-only mode.
  • Hello. In the game I'm working on (with someone from TIGSource), I'm wanting a character to be able to charge up a projectile, then shoot it at the increased speed.

    As of now, the projectile (Arrow) has a private variable called 'Power'. I want, while the "Fire" control is held down and 'Power' is below 700, to increase the Power in increments of 175 every 200 milliseconds. Once the "Fire" control is released, the projectile is shot at the speed of 'Power' pixels per second.

    Can anyone help? :<

  • cool thing about construct is,

    often times, you can translate your thoughts pretty directly to events:

    since there is no On Control Released condition (there might be one in the Custom Controls plugin, I don't remember), I'll be using 'left mouse button' instead of "fire" in this example:

    we are going to assume that 'power' starts at 175 when you start holding the button:

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/1.PNG">

    I want, while the "Fire" control is held down and 'Power' is below 700, to increase the Power in increments of 175 every 200 milliseconds.

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/2.PNG">

    Once the "Fire" control is released, the projectile is shot at the speed of 'Power' pixels per second.

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/3.PNG">

    altogether:

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/all.PNG">

  • cool thing about construct is,

    often times, you can translate your thoughts pretty directly to events:

    since there is no On Control Released condition (there might be one in the Custom Controls plugin, I don't remember), I'll be using 'left mouse button' instead of "fire" in this example:

    we are going to assume that 'power' starts at 175 when you start holding the button:

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/1.PNG">

    >

    > I want, while the "Fire" control is held down and 'Power' is below 700, to increase the Power in increments of 175 every 200 milliseconds.

    >

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/2.PNG">

    > Once the "Fire" control is released, the projectile is shot at the speed of 'Power' pixels per second.

    >

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/3.PNG">

    altogether:

    <img src="http://dl.getdropbox.com/u/1013446/s/powerpro/all.PNG">

    Wow, thanks a lot!

    It's too bad that one can't release an Application-controlled Control... oh well.

    I'll check out that "Custom Controls" plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's too bad that one can't release an Application-controlled Control... oh well.

    what do you mean?

  • >

    > It's too bad that one can't release an Application-controlled Control... oh well.

    >

    >

    >

    what do you mean?

    It's too bad that one can't a make a "Release" event for a dynamic "Control"... instead of "On Key Released", it'd be nice if one could set a "On Control Released".

  • You can define custom controls in the application properties.

  • It's a shame the images containing the events have disappeared :(

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