forever if <<[Fly key v] pressed> And <(Fuel) > [0]>> Change y by [1] set (Flight v) to 1 else set (Flight v) to 0I hope this is what you were looking for. I assume you have some sort of gravity to make him fall down already set. Otherwise, just insert "Change y by -#" at else.
forever if <(Flight) = [1]> Change (Fuel) by -1 wait 0.1 secs
Offline
Harald wrote:
forever if <<[Fly key v] pressed> And <(Fuel) > [0]>> Change y by [1] set (Flight v) to 1 else set (Flight v) to 0I hope this is what you were looking for. I assume you have some sort of gravity to make him fall down already set. Otherwise, just insert "Change y by -#" at else.
Below is a way for the fuel to be drained only when the guy is flying.forever if <(Flight) = [1]> Change (Fuel) by -1 wait 0.1 secs
Lol, there is no
<key [fly key v] pressed?>block. It would be cool if there was a block with that in it but what about a maze or something different from a flying project?
when gf clicked forever if <key [fly key v] pressed?> change x by [5] end if <key [fly key v] pressed?> change y by [-5] end if <key [fly key v] pressed?> change x by [-5] end if <key [fly key v] pressed?> change y by [5] end endThere might be a reply to that saying whatever it is a subsitute for. XD But how is GTM9 gonna know which to do?
Last edited by Liamadams (2013-03-29 16:47:51)
Offline
Sorry. The Fly key thing was just a substitute for whichever key they wanted the flying to be activated at.
Also, at that time, my scratchblock skills weren't very good..
Let's say Space is the trigger for flying:
when gf clicked forever if <<key [Space v] pressed?> and <(fuel) > [0]>> change y by [1] set [flight v] to [1] else set [flight v] to [0]
Offline
That is because the brief bit of code here is just to demonstrate how to turn on an off the jetpack assuming there is no ground beneath.
You need to add a collision test to see if the jetpack guy is on the ground and if so NOT do the change Y by 1.
Probably by doing a touching color test.
Offline
Sorry i appologise. That is not that case as the change by 1 is upward movement and only occurs when the space is pressed.
It means that somewhere in your code you have a change y by a "minus value" that does not check to see if the JetPack guy is on solid ground before performing it.
Offline
GTM9 wrote:
Help my guy starts falling as soon as the green flag is clicked
when gf clicked forever if <key [up arrow v] pressed?> change y by [1] else change y by [-1] endif that doesnt work, dont use Haralds scripts (no offense just a suggestion).
when gf clicked forever if <key [right arrow v] pressed?> change x by [2.5] end if <key [left arrow v] pressed?> change x by [-2.5] endhope it works. i havent tried it yet but heres my idea
Last edited by Liamadams (2013-04-06 18:24:07)
Offline
Liamadams wrote:
GTM9 wrote:
Help my guy starts falling as soon as the green flag is clicked
when gf clicked forever if <key [up arrow v] pressed?> change y by [1] else change y by [-1] if <key [up arrow v] pressed?> change y by [1] else change y by [-1] if <key [up arrow v] pressed?> change y by [1] else change y by [-1] if <key [up arrow v] pressed?> change y by [1] else change y by [-1] endif that doesnt work, dont use Haralds scripts (no offense just a suggestion).
also, some more scriptswhen gf clicked forever if <key [right arrow v] pressed?> change x by [2.5] end if <key [left arrow v] pressed?> change x by [-2.5] endhope it works. i havent tried it yet but heres my idea
i think that way gravity works better.
Offline