In need of much help on SDL
Although I have a book, it doesn't help much on things that are really basic to games. Can someone tell me a tutorial or explain these questions for me?
1. How do I flip my image when I change from going left to right.
2. How does the whole idea behind scrolling the background and the placement of objects on it work?
BIG THANKS IN ADVANCE!!!
[Edited by - AntiGuy on September 5, 2004 9:37:40 AM]
"If you are not willing to try, you will never succeed!"GrellinC++ Game Programming
Quote: Original post by AntiGuy
1. How do I flip my image when I change from going left to right.
you dont "flip" one image. you have 2 seperate images, one for going left, and one for going right.
Quote:
2. How does the whole idea behind scrolling the background and the placement of objects on it work?
basically you have to start thinking in WORLD coordinates, not screen coordinates. this is kind of hard to realize at first, but you need to get the notion of screen out of your head. WORLD coordinates is what you need.
once you figure out a world coordinate system, its not that hard. basically, you have a "camera" x/y position. this is your offset into the world, which represents your screen.
personally id try to take things much smaller at a time. youll choke if you try to make a scrolling platformer or RPG for your first game. start small. make pong, then make pacman, THEN try to make a scrollable game. its a lot more work then you think. good luck
FTA, my 2D futuristic action MMORPG
btw you can find the source to my pong and pac-man like game at my website. both games were written using the SDL base lib plus other SDL libs like mixer and image. i should mention the source to both these games isnt exactly the best ever written, but it gets the job done. the only way to learn how to design software is by doing things wrong, no ?
FTA, my 2D futuristic action MMORPG
Check out my web site.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
I think I understand the concept now! But, now I can't find anyway of moving the "camera" (screen). I want the screen to be centered on the character but I haven't exactly heard of any variable that says screen position = Character Position -whatever because I haven't heard of a screen position! Is the variable for screen position just an illusion? If so, how would I go about implementing this?
You will need 2 reference points. The screen view and the world view. Your character will be located at screen-w / 2 - half character w and screen-h / 2 - half character h. The world coordinate will be whatever size your world is. If it is larger than your screen size you scroll by increasing the rect location. So if you have a 1000x1000 world and your screen is 800x600 you will be able to scroll an aditional 200 x and 400 y. Just make sure your rect size is constant.
Hopefully I didn't confuse you more.
Hopefully I didn't confuse you more.
"If you are not willing to try, you will never succeed!"GrellinC++ Game Programming
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement