Page 1 of 1

Need some help in my game. (can close this now)

Posted: Tue Jan 11, 2005 3:50 pm
by Joakim Christiansen
http://www.myhome.no/joakims_gamemaker_page/Game.zip
When i load a background the player sprite gets white, just run it and you will see.
Can someone help me with this? (i'm a noob)

Edit:
Is it also best if i free the sprites and sounds (resources) when i end the game?

Posted: Tue Jan 11, 2005 4:24 pm
by Paul
Where have you defined the values for
spr_player
spr_background
????

And just in case you didn't know, variables inside a procedure are not global unless you make them. ;)

Posted: Tue Jan 11, 2005 4:31 pm
by Joakim Christiansen
And just in case you didn't know, variables inside a procedure are not global unless you make them. ;)
I knew that.
Where have you defined the values for
spr_player
spr_background
????
They are defined in the InitResources() procedure i think...

Posted: Tue Jan 11, 2005 4:53 pm
by Paul
So you see your error now? :)

Posted: Tue Jan 11, 2005 5:04 pm
by Joakim Christiansen
Paul wrote:So you see your error now? :)
CreateSprite3D(spr_player, spr_player)
I must make that global?

Code: Select all

  Global spr_player3d
  ;Sounds
  LoadSound(snd_shoot, "data\sounds\shoot.wav")
  ;Sprites
  LoadSprite(spr_player, "data\sprites\player.bmp", #PB_Sprite_Texture)
  CreateSprite3D(spr_player3d, spr_player)
  TransparentSpriteColor(spr_player, 255, 255, 255)
  LoadSprite(spr_background, "data\images\background.bmp")
That did'nt work, hmm...

Posted: Tue Jan 11, 2005 5:31 pm
by Paul
Here is your updated file...
http://www.reelmedia.org/test/gm.zip

You have not defined spr_player or spr_background so the are both 0. Sprites must have unique numbers, they cannot share. Personally I would make then constants since they never change anyway and then you don't have to worry about making them global. (see update file)

Also, for the least amount of problems, use pure black as your transparent color. TransparentSpriteColor() is not reliable.

Posted: Tue Jan 11, 2005 5:41 pm
by Joakim Christiansen
Thank you very much! :D
I now undestand things a little bether :D

Posted: Tue Jan 11, 2005 8:14 pm
by Kale
Is it also best if i free the sprites and sounds (resources) when i end the game?
You don't have to, PB does this for you once the program is ended.

Posted: Tue Jan 11, 2005 8:45 pm
by Joakim Christiansen
Thanks :D

Posted: Tue Jan 18, 2005 9:39 pm
by matthew180
Paul wrote:Also, for the least amount of problems, use pure black as your transparent color. TransparentSpriteColor() is not reliable.
Can you please expand on this? I'm working on a project with a lot of graphics and I've been using hot-pink (255,0,255) as transparent. Am I going to have "pink background" problems on some systems?

Matthew

Posted: Tue Jan 18, 2005 9:46 pm
by Paul
From my personal experiences... YES

The only color I have never had problems with is the default transparency (0,0,0) pure black.

I prefer using pure black anyways... I make my graphics on a layer in Photoshop. When done, I raise the output level of that layer by 10, set the background layer as 0,0,0 and then save. Works great! ;)