• 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.

lengthdir malformed with statement

C

Coleson Frey

Guest
i even used the code from the manual and it doesnt work
/// randomly shoot
can_shoot -= 1;
event_inherited();

xoffset = x + lengthdir_x(5, obj_rotTurret.image_angle)
yoffset = y + lengthdir_y(5, obj_rotTurret.image_angle)

//xoffset = x + cos(image_angle * pi / 180) * 5
//yoffset = y + sin(image_angle * pi / 180) * 5

if (can_shoot = 30) {
image_index = 2;
}
if (can_shoot = 100) {
image_index = 1;
}

if (can_shoot < 1) {
with instance_create(xoffset, yoffset, obj_turret_cannonball); {
direction = obj_rotTurret.pointdir;
speed = 4;
}
instance_create(xoffset, yoffset, obj_effect_explosion);
can_shoot = (irandom_range(120, 200))
image_index = 0;
}
 

Desix

Member
Code:
with instance_create(xoffset, yoffset, obj_turret_cannonball); {
direction = obj_rotTurret.pointdir;
speed = 4;
}
The semi colon in that first line is your issue.
 

FrostyCat

Member
Can someone please tell me where today's rookies learn to clip off control structures with needless semicolons? This mistake is absurdly common nowadays, yet nobody made it back when I started. It's not in the Manual or any worthwhile written or video tutorials, so where does it come from?
 
Top