Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | tuan |
I follow your first game instruction here
but some time when i test my game, mob was stuck on the screen edge, some time it is running properly. Please help me fix this problem
I tried to restart my laptop, turn it off but can’t. Debugger did not show any notice
Some time it is be running normally after i turn off laptop for few hour
func _on_MobTimer_timeout():
$MobPath/MobSpawnLocation.set_offset(randi())
var mob = Mob.instance()
$MobContainer.add_child(mob)
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
mob.position = $MobPath/MobSpawnLocation.position
direction += rand_range(-PI / 4, PI / 4)
mob.rotation = direction
mob.set_linear_velocity(Vector2(rand_range(mob.MIN_SPEED, mob.MAX_SPEED), 0).rotated(direction))
Thanks you