Increasing Projectile Speed Every X Millseconds

For questions about using Classic.

Post » Tue Nov 03, 2009 2:39 am

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? :<
B
14
S
2
G
5
Posts: 37
Reputation: 2,777

Post » Tue Nov 03, 2009 2:59 am

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:


[quote="partymetroid":1zd17pfq]
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. [/quote:1zd17pfq]

[quote="partymetroid":1zd17pfq]Once the "Fire" control is released, the projectile is shot at the speed of 'Power' pixels per second.[/quote:1zd17pfq]



altogether:
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Tue Nov 03, 2009 4:08 am

[quote="lucid":1kmffqao]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:


[quote="partymetroid":1kmffqao]
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. [/quote:1kmffqao]

[quote="partymetroid":1kmffqao]Once the "Fire" control is released, the projectile is shot at the speed of 'Power' pixels per second.[/quote:1kmffqao]



altogether:
[/quote:1kmffqao]
Wow, thanks a lot! :)

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

I'll check out that "Custom Controls" plugin. ;)
B
14
S
2
G
5
Posts: 37
Reputation: 2,777

Post » Tue Nov 03, 2009 4:35 am

[quote="partymetroid":t214efh8]
It's too bad that one can't release an Application-controlled Control... oh well. :D

[/quote:t214efh8]
what do you mean?
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Tue Nov 03, 2009 8:18 pm

[quote="lucid":20itjv5a][quote="partymetroid":20itjv5a]
It's too bad that one can't release an Application-controlled Control... oh well. :D

[/quote:20itjv5a]
what do you mean?[/quote:20itjv5a]
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". :(
B
14
S
2
G
5
Posts: 37
Reputation: 2,777

Post » Tue Nov 03, 2009 11:17 pm

You can define custom controls in the application properties.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Mon Jul 29, 2013 11:23 am

It's a shame the images containing the events have disappeared :(
B
15
S
6
G
3
Posts: 87
Reputation: 4,304


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests