Problems whith my first game... :-(

I am learning programation in c… Or at least I am trying ;-). I have
done my first steps myself, making my way through the tutorials and
manpages I found, writing the whole thing from the beginning a few times
whith several programming languages, until I chose SDL. My game (a
bomberman-like… what originality :slight_smile: can now display some sprites
(whithout using the surfaces : I made my own files for the animations,
and format) but I got some nasty bugs which I don’t understand, so I am
in need for help, if someone was kind to give me some.
Here are my problems :

  1. My function to blit a sprite on the screen whith a LockSurface works
    if I declare a variable (anything) which I don’t use, but segfaults if I
    don’t.
  2. My function to load a sprite from the file is ok, but my first sprite
    is overwritten when I load the second (the function returns a pointer)

Ask me if you need my sources, and please scuse me if I am a bit
off-topic. And also if my english is too bad… Not easy for a young
french guy. Thanks !

Nimrod

Louis Gesbert wrote:

  1. My function to load a sprite from the file is ok, but my first sprite
    is overwritten when I load the second (the function returns a pointer)
    This sounds like you are re-using the same block of memory for each
    sprite.
    You have to allocate memory for each sprite you load.
		-fjr-- 

Frank J. Ramsay
@Frank_Ramsay