Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [C++ Help] SDL Platformer Game
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shinobu




PostPosted: Mon Dec 30, 2013 5:43 pm   Post subject: [C++ Help] SDL Platformer Game

So I came back to programming after I stopped for a month and after I reviewed the stuff I learnt, I decided to try and make a platformer game.
The problem with my program is, after I press the up button (which is supposed to make my character jump), the player just floats in the air, and never comes back down.

The player's Y position just keeps going higher and higher, and never stops (the Y value goes lower and lower).
I've tried several ways to fix the problem, which they made it not as worse as when I first made it, but the player still has flying powers that I don't want.

Can someone please take a look at what I did wrong here?
I might have to work with simpler projects first. Aiming high when I first come back into programming again might not be too good. Sad

The player logic is in the player.cpp file

Edit: I UPLOADED THE WRONG FOLDER. Sorry Dreadnaught Sad

Both the catmario zip files are the same, I'm not sure why there's 2 uploaded.



Cat Mario.zip
 Description:
This is the project files

Download
 Filename:  Cat Mario.zip
 Filesize:  192.26 KB
 Downloaded:  285 Time(s)


Cat Mario.zip
 Description:
This is the project files

Download
 Filename:  Cat Mario.zip
 Filesize:  192.26 KB
 Downloaded:  251 Time(s)


Debug.zip
 Description:

Download
 Filename:  Debug.zip
 Filesize:  5.05 MB
 Downloaded:  1143 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon Dec 30, 2013 8:57 pm   Post subject: RE:[C++ Help] SDL Platformer Game

I can't look at your code right now, so I'm not sure if this is your issue, but remember that in sdl (and most graphics libraries), (0,0) is the top-left corner and increasing the y coordinate goes down. So to jump, you actually want to decrease the y value.

It could also be that you haven't implemented gravity yet. There are plenty of tutorials on this available in Turing Help. Don't worry that the examples are in Turing, the concepts still apply.
Shinobu




PostPosted: Tue Dec 31, 2013 3:25 pm   Post subject: Re: RE:[C++ Help] SDL Platformer Game

Insectoid @ December 30th 2013, 8:57 pm wrote:
I can't look at your code right now, so I'm not sure if this is your issue, but remember that in sdl (and most graphics libraries), (0,0) is the top-left corner and increasing the y coordinate goes down. So to jump, you actually want to decrease the y value.

It could also be that you haven't implemented gravity yet. There are plenty of tutorials on this available in Turing Help. Don't worry that the examples are in Turing, the concepts still apply.


Yup, I remember (0,0) is in the top left corner and increasing the y coordinate goes down.
I think I just didn't do the gravity properly. I'll look into that. Razz
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: