GAME MAKER Problem with sprites! Can't see the sprite after mouse action
Posted
by
user46882
on Game Development
See other posts from Game Development
or by user46882
Published on 2014-06-07T15:36:46Z
Indexed on
2014/06/07
15:41 UTC
Read the original article
Hit count: 276
sprites
|game-mechanics
I have got a problem in Game Maker Pro:
http://www.directupload.net/file/d/3646/egdpdu6u_gif.htm
At the start we see a white square moving. If I press a key the square stop to move and the background changes to white. If the background changes to white a new animation/sprite should play on the same position where the white square was. BUT IT DOESNT! (Actually it is still there! It just does not move and this is fine) The animation is basically a sprite animation with some outlines of the square. If I press a key again, the background changes to white and we see the animation of the sprite.. but we do not see the animation of the sprites when it does not move. And this is strange!! I want to have the animation of the square when it doesn't move. But I don't get it.. by the way.. the .gif is a old version. I allready fixed the problem with the moving animation.. but I am still not able to play the animation if the square does not fly. The color of the animation is allready set to green or something! for better contrast. But still.. can't see it.
Here is the code:
obj.weisse.kugel.stepevent = the white square with the movements and sprite animations etc.
if (global.kweiss == 1 ) { //
vspeed = 8;
//visible = true //
sprite_index=spr_weisse_kugel;
image_speed = 0;
image_index = 0;
}
else if (global.kweiss == 0) {
sprite_index=spr_animation_fade_out;
image_speed =0.2;
image_index=image_number-1
vspeed = 0;
//visible = false //
}
then I have 1 create event for all the global.variables
obj.global_var
globalvar kweiss;
kweiss = 1;
globalvar kschwarz;
kschwarz = 0;
and then I have 1 controll stepevent in a new obj:
if device_mouse_check_button_pressed (0, mb_left) {
if background_color = c_black {
background_color = c_white
}
else {
background_color = c_black
}
// change of the square to white
if (global.kweiss = 0)
{
global.kweiss = 1;
}
else {
global.kweiss = 0;
}
if (global.kschwarz = 0) // change the square to black (other bullets.. we do not need this at the moment!)
{
global.kschwarz = 1;
}
else {
global.kschwarz = 0;
}
Many thanks in advance
© Game Development or respective owner