Gravity Flip Woes

Hey guys, im quite new to GS and im currently making a game with a gravity flip option (or atleast trying).
Here is the method i have at the moment but i seem to get contrasting behaviours and i would very much appreciate some advice.
i create an attribute called gravflip (integer set to 0)
on my iphone button, i have the rule.
if touch is released + attribute 'gravflip = 1' - change attribute gravflip to 0
in the otherwise i have the rule:
Otherwise
if touch is released + attribute 'gravflip = 0' - change attribute gravflip to 1
afaik. that should set the controls right.
on the player side of things. i have an accelerate behaviour going down at 1500 and have it set to otherwise:
if gravflip = 1 - accelerate up - 1500
could someone tell me please what im doing wrong?
ive spent like 3 hours on this and i have my suspicions that the game attribute is constantly switching between 0-1 and this is giving me some sort of slow accelerating hover effect.
hase anyone else encountered this, and if so, how can i fix it?
Thanks,
Craig
PS: LOVE THIS COMMUNITY!
Here is the method i have at the moment but i seem to get contrasting behaviours and i would very much appreciate some advice.
i create an attribute called gravflip (integer set to 0)
on my iphone button, i have the rule.
if touch is released + attribute 'gravflip = 1' - change attribute gravflip to 0
in the otherwise i have the rule:
Otherwise
if touch is released + attribute 'gravflip = 0' - change attribute gravflip to 1
afaik. that should set the controls right.
on the player side of things. i have an accelerate behaviour going down at 1500 and have it set to otherwise:
if gravflip = 1 - accelerate up - 1500
could someone tell me please what im doing wrong?
ive spent like 3 hours on this and i have my suspicions that the game attribute is constantly switching between 0-1 and this is giving me some sort of slow accelerating hover effect.
hase anyone else encountered this, and if so, how can i fix it?
Thanks,
Craig
PS: LOVE THIS COMMUNITY!
Comments
Maybe experiment with using the Change Velocity behaviour instead? This should be more instant, as you want.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
this is driving me insane, because it 'should' work with either method
because i now have a longer string of
button attrib=0
on press change to 1 (and vice versa)
attrib = 1
change actor attrib = 1 (and vice versa)
actor attrib = 1 (accelerate upwards)
the reaosn i came to this conclusion is that now i have the flip 'half' working. once the button is pressed once, the flip works perfectly. however, after a single press, the values of the attributes no longer seem to change.
im using integers for the attributes. is there anything that could be a problem there?
2 Game Attributes.
gravity - real attribute
gravflip - integer attribute
Now For you button
Touch is pressed
--Change game.gravflip to (game.gravflip+1)%2
second rule
When game.gravflip is 0
Change game.gravity to 270
otherwise
Change game.gravity to 90
---------------------------
Now in all of your actors affected by gravity remove all of your accelerate rules and just place a single accelerate behavior at the top.
And in the direction box use the expression editor and and select game.gravity
This will flip the gravity back and forth each time the flip button is pressed
when actor receives event touch is pressed change game.gravity to -game.gravity
on the actors that you want affect add an accelerate behaviour with direction: 90 relative to scene and acceleration game.gravity
This is probably the most efficient way to do it
is there any chance someone could take a look at it and see where im going wrong exactly?
Direct Link:
http://www.megaupload.com/?d=14SGNTUD
Once you get it sorted the method I posted will do the trick.
Darren.
http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./Free_Stuff.html
http://gamesalad.com/g/35290
Hope That helps.
its my first project, so im afraid, i dont quite know exactly what id be looking for
And the rest of you guys really.
Thanks alot for all of the help.
something within the button animation was stupidly conflicting with the gravity flip attribute, so i deleted the button and inserted a fresh actor and then copied the code example and it works. really sorry to have been a pain!