sonic dosen't want to jump

Talk about making games.

sonic dosen't want to jump

Postby sonicforvergame » Mon Jun 08, 2015 1:42 pm

well this is the game data for just the concept of sonic HD
it doesn't have much but it is basically what i made so far.
so you can first check how the game will act and also try and solve this problem
1- sonic can physically jump but no matter what id o he wont change into the jumping animation.
if you load it into game mode it will be easier for you to understand and if you can i would appreciate if you could solve the jumping animation problem
Attachments
sonic1hd.rar
(2.02 MiB) Downloaded 155 times
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby Hblade » Mon Jun 08, 2015 2:56 pm

Tips on programming:
Make a text variable that displays a list of your variables currently being used (This helps debug issues)

Example:
Code: Select all
sprintf(text, "Jump: %d\nYvelocity: %f", jump_variable, yvelocity);


where jump variable checks and sees if jump is activated.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: sonic dosen't want to jump

Postby sonicforvergame » Mon Jun 08, 2015 3:38 pm

Thanks hblade that is really nice ,now i am sure sonic jumps but he still dosent do the jumping animation when i press the jump button? Did you find out why that happens?
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby Hblade » Mon Jun 08, 2015 4:19 pm

I haven't opened the GED, just giving a bit of advice that may help :)

Make sure in draw actor nothing is changing his animation, also make sure that the collision with the ground isn't changing his animation either.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: sonic dosen't want to jump

Postby koala » Mon Jun 08, 2015 4:23 pm

Sonic jumps only in the beginning of the game, before you press any other button.
At the start all variables are 0, so
Code: Select all
sprintf(str,"Sonic%s%s%i",stateText[run],directText[lastdirect+1],speed/20+1);
will give "SonicStandNothing1".
That code will execute every frame, but you don't have animation with that name, so animation won't change.
Also, state = 0.
When you press "space" Sonic jumps and jump animation activates. state = 8. However, that animation continues even when Sonic touches the ground.
When you move Sonic you change variables and animation you activate every frame exists, so "there's no time" for jump animation to activate.
I suppose you need to reset all variables in order to activate jump animation.
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: sonic dosen't want to jump

Postby sonicforvergame » Mon Jun 08, 2015 5:53 pm

well i removed all the switch state system because i am not able to use it how i should . I am not able to know when to use each state and how it works so i removed every state mechanism.
But state mechanism is really good for multiple animation and i wanted to ask if you could help me with it In PM or something
Would you mind if i PM you my questions?
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby koala » Mon Jun 08, 2015 6:00 pm

Send them, no problem. But may I ask, why PM, why not post them?
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: sonic dosen't want to jump

Postby sonicforvergame » Mon Jun 08, 2015 6:15 pm

because i actually need help with sate and not just concept i mean how to use and how it works i think i am using it the wrong way
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby koala » Mon Jun 08, 2015 6:55 pm

sonicforvergame wrote:because i actually need help with sate and not just concept i mean how to use and how it works i think i am using it the wrong way
Good you've mentioned that. That reminded me that you forgot to put
Code: Select all
break;
at the end of every case. Unfortunately it doesn't change anything, but it is something you should do.
For example:
Code: Select all
switch (state) {
    case 1: a = 5;
    case 2: b = 6; break;
    case 3: c = 7; break;
}
If state == 1: a = 5, b = 6.
if state == 2: b = 6.
If state == 3: c = 7.
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: sonic dosen't want to jump

Postby sonicforvergame » Mon Jun 08, 2015 8:49 pm

But what does case means? Is it the animation for instance, run-right is registered as the third animation on the players animation list. So case=3 represent the actor when doing run-right animation?
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby koala » Mon Jun 08, 2015 9:49 pm

I am not sure I understand what confuses you. :?
Let me tell you a few things about switch, which you may already know.
switch is from C language and it looks like this:
Code: Select all
switch (some_integer_variable) {
    case a: some_code; break;
    case b: some_code; break;
    case c: some_code; break;
    ...
    default: some_code; break;
}
This code has nothing to do with Game Editor, this is how C switch looks, wherever you use it and whenever you use it.
a, b, c, ... are integer values.
case a: some_code; break; means - in case that some_integer_variable has value a, do some_code.
You don't need to put break at the end of case, but then the next case will execute and so on until the first break.
default is not necessary. It will execute if value of some_integer_variable doesn't match any case.
So, switch is used for multiple choices. Which choice will be executed depends on some_integer_variable.

As I can see, you change state variable only inside switch. In the beginning it is 0 because you didn't initialize it. So case 0 will execute. One of the consequences is that state is now 1, because of code line state = 1;. switch has nothing to do with animations and their position on players animation list.
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: sonic dosen't want to jump

Postby sonicforvergame » Tue Jun 09, 2015 6:15 am

I got it know and i managed to make the game work using the switch methode it is a really nice add to the game. thanks a lot for helping me out
Kaizoku ni ore wa naru
User avatar
sonicforvergame
 
Posts: 422
Joined: Sat Sep 01, 2012 2:17 pm
Score: 10 Give a positive score

Re: sonic dosen't want to jump

Postby koala » Tue Jun 09, 2015 12:12 pm

No problem. :D
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest