Legacy GM Cannot make sprite animation stop

Y

Ysela_Creyo

Guest
Hi, i'm having this issue without a clue on how to solve it.

In my character selection room y have an object which will set the frame (sub-image) of the player and CPU, and also the preview.

for this In my object (arrows) I'm using "image_index -= 1 (for the back) and image_index += 1 (for the next) when click in "arrows" this is working in the character selection room preview, but suppose should work too for the while the game is playing, since this action also repeat for player and cpu object in game. but when going to the gaming room, the sprite keep's looping (all subimages)

I created a step event in CPU and player object, to let's say set: if "image_index == 4 then image_speed = 0;"

but I didn't work because, it stops the looping frame animation, but didn't let you select the character, it's set to the first index in the created step, in change of the one choose in the selection room.
 
I am not sure if I understood your problem.
You are in the room for the character selection. Inside the room when you pick a character, it's sprite will start playing and the character will also give you information about itself. When you go to the gaming room, the sprite keeps playing, even after "image_speed=0". Is that it? May you give a screenshot of your rooms so I can see how it looks.
 
Y

Ysela_Creyo

Guest
I am not sure if I understood your problem.
You are in the room for the character selection. Inside the room when you pick a character, it's sprite will start playing and the character will also give you information about itself. When you go to the gaming room, the sprite keeps playing, even after "image_speed=0". Is that it? May you give a screenshot of your rooms so I can see how it looks.
Yeah it's exactly like that, the image_index -= 1 executes everytimes you press left mouse clikc, in the character selection room this seeems to work fine, since every click I can change the sprite frame I speck, but when I click next (meaning is selected CPUs or Player the character wanted). The play room start but the character shows all (i guess all, since I can't actually see, becuase too fast) the frames. If I set the image_speed for the image_index == x, then the frame would be the last "x" ( index number) i have in the code, and not the one selected. which means not the character selected.

In the playing room I also have set other a room speed, and an increase of the speed for other object. Does this affect the "image_speed = 0" I set to CPU and Player obj?
 
room_speed does effect the speed of everything in the game, so I suggest you setting the room_speed before you do anything else after it.
I think I get it what's the problem here. Try using one object for the room selection and the other in the gaming room.
Are you using D&D or just code? If you use code, copy&paste it here.
 

Bingdom

Googledom
Put
Code:
image_speed = 0
in the create event. By default, this is greater than 0 (not sure exactly what it is).

Likely it's a decimal value and image_index == 4 may never actually become true, due to the decimal value. ( '==' comparisons have to be exact in order to be true)
 
Y

Ysela_Creyo

Guest
room_speed does effect the speed of everything in the game, so I suggest you setting the room_speed before you do anything else after it.
I think I get it what's the problem here. Try using one object for the room selection and the other in the gaming room.
Are you using D&D or just code? If you use code, copy&paste it here.
I'm using code:

in the left arrows I have this code two times one aplly to the selector object, and the other apply to the cpu object

image_index -= 1

I know this is working because if i put the arrow in the gaming room, i can change the sprite of the cpu (and this one didn't animates); but if do it in the selector room, after click "star game" (go to gaming room) cpu animates.

----

In the CPU object I have this:

/// IA Simple
if (instance_exists(obj_bola)){

// if 0,1,2 => 60% y 3,4 => 40% chances CPU didn't move
if (irandom(4) < 3){

if (obj_bola.y > y) {
y += abs(obj_bola.vspeed)*1.5;
} else {
y -= abs(obj_bola.vspeed)*1.5;
}

}

y = clamp(y,115,610);
}

in the gaming room i have this object with this step

/// check if have score
if (x<0) {
global.puntos_jugador++;
obj_marcador.alarm[0] = room_speed * 1.5;

// Play fail sound
audio_play_sound(snd_fallo,95,false);

instance_destroy();
}

if (x>room_width) {
global.puntos_cpu++;
obj_marcador.alarm[0] = room_speed * 1.5;

// check colision

if (colision){

// Incrementar la velocidad
speed += incremento;
if (speed > 25) speed = 25;

// Reproducir sonido toque jugador
audio_play_sound(snd_toque,90,false);
 
Top