Easiest anti-moonwalk of all the time!

Non-platform specific questions.

Re: Easiest anti-moonwalk of all the time!

Postby youbob1212 » Sat Apr 23, 2011 12:33 pm

Hello, Hey very good job, but could you show a step by step tutorial. Because as a noob, I don't really know what you did or which steps did you take to make this product.

Thanks anyways, and if not I will figure it out someday.
Oh look at the pretty little computer virus taking over your WINDOWS computer
Image
Linux(ubuntu) RULES
youbob1212
 
Posts: 28
Joined: Fri Apr 15, 2011 5:02 pm
Score: 0 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby SuperSonic » Sat Apr 23, 2011 12:49 pm

Nice job lcl :D
+point

I'm having a little trouble understanding your code though :)
In the key down event, what does "if (!stop)" mean?
Second, what does "sprintf" do?
And third, i'm having trouble understanding the switch statement for when both keys are pressed.
Could you help me a little? :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby schnellboot » Sat Apr 23, 2011 1:37 pm

SuperSonic wrote:Nice job lcl :D
+point

I'm having a little trouble understanding your code though :)
In the key down event, what does "if (!stop)" mean?
Second, what does "sprintf" do?
And third, i'm having trouble understanding the switch statement for when both keys are pressed.
Could you help me a little? :P


1. if(!stop) is similar to if(stop==0)

2. sprintf(stringVar, "string") put's the "string" in stringVar

3. the switch statement is if the previous animation was left or leftStop it's changed to leftStop and if prevAnim was right or rightStop it's changed to rightStop
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby Game A Gogo » Sat Apr 23, 2011 3:17 pm

http://www.rohitab.com/discuss/topic/11 ... rial-in-c/

sprintf is one heck of a time saver... I use it almost in every game I make now!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby SuperSonic » Sat Apr 23, 2011 4:32 pm

Thanks schnell :D
but when I said I was confused about the switch statement i meant I was confused why he put case 0 and then put no instructions for it. Same with case 1.
Could you help me with that? :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby schnellboot » Sat Apr 23, 2011 8:04 pm

yes
case 0:
case 2:
means if 0 or 2
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby SuperSonic » Sat Apr 23, 2011 8:55 pm

Aha :P Thanks
+point :wink: :wink:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby lcl » Sat Apr 23, 2011 9:53 pm

Sorry SuperSonic, I wasn't here to see your post..
I would have helped you if I saw it earlier. :)

And youbob1212:
The code works by printing the animation name to global variable and then changing that named animation for the actor. :) ask more if you need to. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby SuperSonic » Sat Apr 23, 2011 10:38 pm

Sorry SuperSonic, I wasn't here to see your post.

That's Ok :D
But maybe you could explain why you did not set any instructions after case 0 and case 2 :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby schnellboot » Sun Apr 24, 2011 7:18 am

SuperSonic wrote:But maybe you could explain why you did not set any instructions after case 0 and case 2 :P

so you want him to explain it or didn't you understand what I said?
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby lcl » Sun Apr 24, 2011 7:25 am

Oh, yeah I should have commented also those lines.
0 and 2 are animations facing left and 1 and 3 facing right.
This code
Code: Select all
switch(prevAnim)
{
    case 0:
    case 2:
        sprintf(anim, "charStopLeft");
    break;

    //and so on with cases 1 and 3..
}

works just the same as this would:
Code: Select all
if (prevAnim == 0 || prevAnim == 2)
{
    sprintf(anim, "charStopLeft");
}
//continues with prevAnim == 1 || prevAnim == 3


So, if two cases are put in line without break; between them they will share the same code until break;

Did that help you? :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Easiest anti-moonwalk of all the time!

Postby SuperSonic » Mon Apr 25, 2011 2:52 am

Oh Ok, I was still a little confused even after schnell explained it but I understand now :P
Thanx
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest