Jump to content

  • Log In with Google      Sign In   
  • Create Account

MrTheFoxx

Member Since 25 Nov 2011
Offline Last Active Feb 27 2012 02:18 PM

Topics I've Started

FPS Limiting

09 February 2012 - 03:56 PM

Right now, I have a loop for the game. I'll post some pseudo code to illustrate it.

while(playing) {
frames++;
if(frames>FPS) frames=0;
if(frames==FPS) {
// All game functions for displaying the player and map and stuff.
}
}

Am I going about this the right way? It has really slowed the game down, but there is still a lot of CPU being used. How can I cut down on that the right way? Is this a good way to limit the FPS? Thank you. :3

Frame Independent Motion/Animation in SDL

29 January 2012 - 12:46 PM

I've done a lot of research to find nothing, so I'm posting here. Here goes nothing.

I have two images: a red circle and a blue circle. I have some controls set up. I want the sprite to swap between the red circle and the blue circle every half second and I want it to move across the screen at the same speed of forty pixels per second, both independent from the frame rate. Can anyone give me a minimal example of this being done in C (not C++ or C#... C)? Thank you. :)

Screen Cropping SDL

14 January 2012 - 10:54 PM

This is one of the few things bugging me. Getting a camera to scroll. I load the whole area, but I need to crop out only a certain part of the screen and display it... like so:

Posted Image
Becomes...
Posted Image

(I used Quote tags so the white in the images doesn't blend with the post background.)
I would change the offset to crop throughout the map as the player moved, which would equal camera scrolling. Can someone give me some example SDL code for doing this? I'm sure it is simple. I just don't understand it. I can already do it with an image and make scrolling backgrounds. It is just making the player and enemies and such move with the camera that is confusing. Please clear this up for me. Thank you. Posted Image

SDL - Camera Movement

25 November 2011 - 05:59 PM

My progress was going well until I realized that I'm going to need some sort of camera movement in my levels. At first, I felt that I could just have each tile moved as the player moves and that would be camera movement from one part of the level to the next. Is there a more efficient way to do this, such as having the viewing area itself follow the player instead of leaving it in one place and moving each and every part of the area (including enemies and other things) based on player movement? Thank you! ^^

PARTNERS