• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM Why does sprite-switching break my room transition?

Focksbot

Member
I have a fade out/fade in room transition set up with a persistent player object. It worked absolutely fine until I started adding running animations to the player object. The following code now breaks the room change every time - it fades out but fails to switch to the new room.

Code:
if speed > 0 {

    if sprite_index = spr_jink {
        sprite_index = spr_rat_running
    }
    image_speed = speed/12;
    if direction > 90 and direction < 270 {
        image_xscale = 1
    }
    else image_xscale = -1

}

if speed = 0 and sprite_index = spr_rat_running {

    sprite_index = spr_jink

}
To be absolutely clear, when I remove the above code from my player object, the room transition works *every* time. When I add this code in, it fails *every* time.

Note: it is a separate object that handles room transition - a warp object that activates when the player object collides with it.
 
P

peterwjdibble

Guest
Could you post the code for the collision / room transition as well? That might help give us some more visibility into why it's not triggering.

Side note: In "If" statements it's good practice to use double-equal signs (==). If I remember correctly, GML functions fine without this, but it's a good coding habit and reduces the chance of accidental bugs.
 

GMWolf

aka fel666
It would also described how it fails.
Does it not have the intended effect? Or does ir show an error message?
 
Top