Unexcepted symbol in expression (GMS 1.4)

Sedgwick2K

Member
GML:
///Shooting

if (shoot > 0)
    shoot--
   
if (mouse_check_button_pressed(mb_left) && !shoot)
{
    with(obj_gun)
    {
        image_index = 0;
        image_speed = 0.5;
    }
    audio_play_sound(snd_pistol, 1, false)
    shoot = 10
   
    var bullet = instance_create(x, y, obj_bullet)
    bullet.z = player_height //This line gives me "Unexcepted symbol in expression" error
    bullet.xto = xto - x
    bullet.yto = yto - y
    bullet.zto = zto - player_height
    bullet.damage = 20
}
GML:
z = 0
xto = 0
yto = 0
zto = 0
damage = 0

//These are variables assigned on obj_bullet Create event.
 
Last edited:

Sedgwick2K

Member
Which is an old version of Game Maker that still had the instance_create function.

Is player_height a variable in the instance that's running this code?
Yes, obj_player has player_height variable.

I currently watch a 3D FPS tutorial since I decided to go 3D after lots of 2D demos. player_height is the variable that defines third dimension of player.

ADDITION: I solved the problem. I did not wrote ";" symbol at end of any code since it is largely optional in GML, but somehow caused the error.

And thanks for your attention.
 
Top