Page 1 of 1

ReverseAnti Gravity demo walk right side up or upside down!!

PostPosted: Thu Feb 24, 2011 5:35 pm
by again
I am in the belief there are no limitation you can have. Now with this you can reverse gravity and walk along walls. This is absolutely amazing and fun , just think of the games we could make!!!!

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Thu Feb 24, 2011 5:39 pm
by schnellboot
some day pyro made a game with gravity changing it was pretty fun I think ..

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Thu Feb 24, 2011 6:44 pm
by MrJolteon
You mean Mazeman?

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Thu Feb 24, 2011 7:35 pm
by Hblade
nice dude :D

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Fri Feb 25, 2011 6:22 am
by MrJolteon
Nice, reminds me of a flash game called VVVVVV(It's just a demo)

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Fri Feb 25, 2011 5:07 pm
by Bee-Ant
Kren, I think I will post the optimization here as well. So that we all can learn it.

OK, here's my optimization...

Edit:
1. Mario -> KeyDown -> Space to be:
Code: Select all
int tmp=antigravity;
if(tmp==-1)
{
    ChangeAnimation("Event Actor", "upside down right", FORWARD);
    antigravity=1;
}
if(tmp==1)
{
    ChangeAnimation("Event Actor", "Small_Mario_Run_Right", FORWARD);
    antigravity=-1;
}

2. Mario -> DrawActor to be:
Code: Select all
x+=8;
yvelocity=-antigravity*12;

it will make yvelocity to be 12 if antigravity is -1, and -12 if antigravity is 1.
So the basic is just use the antigravity value to decide the yvelocity.
Even simpler than using IF ELSE right?

Also, don't forget to add:
Mario -> CreateActor:
Code: Select all
antigravity=1;

As the default value. Since we don't use 0 value anymore, so we need to set the initial value.

If you want to make it even simpler, you can edit the Keydown code to be like this:
Code: Select all
int tmp=antigravity;
char str[4][64]={"Small_Mario_Run_Right","none","upside down right"};
ChangeAnimation("EventActor", str[tmp+1], FORWARD);
antigravity=tmp*-1;

So it will change the animation by pointing the array value.
If tmp is -1, then it will point str[0], where str[0] is "Small_Mario_Run_Right"
If tmp is 1, then it will point str[2], where str[2] is "upside down right"
What about str[1] then???
It will point str[1] if tmp is 0. Since we don't use 0 value for tmp (or antigravity in this case), so we can just ignore it.
That's why I type "none" on it.

Hope that helps :D

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Mon Feb 28, 2011 4:52 pm
by again
Thanks bee-ant Iam glad you guys enjoyed the game.

Re: ReverseAnti Gravity demo walk right side up or upside do

PostPosted: Tue Mar 01, 2011 1:01 pm
by lcl
Good job kren! :)
But one thing. You should disable changing the gravity
when player isn't touching the ground.