-1

I'm working on a mobile game that involves a breaking wall. I have my sprites set to change on an alarm. I created an object and placed it in the room with no sprite to handle the event triggers since I thought it might be the creation code for the room that was causing problems. I.E. (Creation code was a bad place to execute)

The creation code for the object sets the alarm to 60

The code I'm using is linked to alarm[0] here:

var WallBreakVal

WallBreakVal = random_range(1, 9);

with(Wall_tiles1)
{
    if WallBreakVal = 1
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles2)
{
    if WallBreakVal = 2
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles3)
{
    if WallBreakVal = 3
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles4)
{
    if WallBreakVal = 4
    {
        sprite_index = Wall2 
    }
}

with(Wall_tiles5)
{
    if WallBreakVal = 5
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles6)
{
    if WallBreakVal = 6
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles7)
{
    if WallBreakVal = 7
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles8)
{
    if WallBreakVal = 8
    {
    sprite_index = Wall2 
    }
}

with(Wall_tiles9)
{
    if WallBreakVal = 9
    {
    sprite_index = Wall2 
    }
}    

alarm[0] = 5*room_speed;

1 Answers1

0

The problem was the random_range function. Irandom function returns an integer instead of the entire range