update movement
This commit is contained in:
parent
631f8ef6e7
commit
3a88fd7031
@ -10,12 +10,17 @@ const MOVEMENT_VECTORS = [
|
|||||||
Vector2.LEFT
|
Vector2.LEFT
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var directioncount = 0
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if position != null:
|
if position != null:
|
||||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||||
queue_free()
|
queue_free()
|
||||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
if directioncount == 0:
|
||||||
move_and_collide(movement * 2)
|
direction = MOVEMENT_VECTORS[randi() % 4]
|
||||||
|
directioncount = (directioncount + 1) % 5
|
||||||
|
move_and_collide(direction * 2)
|
||||||
|
|
||||||
func _on_Hurtbox_area_entered(_area):
|
func _on_Hurtbox_area_entered(_area):
|
||||||
$Hurtbox/death.play()
|
$Hurtbox/death.play()
|
||||||
|
@ -14,6 +14,9 @@ const MOVEMENT_VECTORS = [
|
|||||||
Vector2.LEFT
|
Vector2.LEFT
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var directioncount = 0
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if crowd > 0:
|
if crowd > 0:
|
||||||
crowd -= 1
|
crowd -= 1
|
||||||
@ -39,8 +42,10 @@ func _physics_process(_delta):
|
|||||||
rootnode.add_child(malechild)
|
rootnode.add_child(malechild)
|
||||||
if pregnancy > 0:
|
if pregnancy > 0:
|
||||||
pregnancy = pregnancy + 1
|
pregnancy = pregnancy + 1
|
||||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
if directioncount == 0:
|
||||||
move_and_collide(movement * 2)
|
direction = MOVEMENT_VECTORS[randi() % 4]
|
||||||
|
directioncount = (directioncount + 1) % 5
|
||||||
|
move_and_collide(direction * 2)
|
||||||
|
|
||||||
func _on_Hurtbox_area_entered(_area):
|
func _on_Hurtbox_area_entered(_area):
|
||||||
$Hurtbox/death.play()
|
$Hurtbox/death.play()
|
||||||
|
@ -11,6 +11,9 @@ const MOVEMENT_VECTORS = [
|
|||||||
Vector2.LEFT
|
Vector2.LEFT
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var directioncount = 0
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if position != null:
|
if position != null:
|
||||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||||
@ -21,9 +24,11 @@ func _physics_process(_delta):
|
|||||||
queue_free()
|
queue_free()
|
||||||
else:
|
else:
|
||||||
age = age + 1
|
age = age + 1
|
||||||
|
|
||||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
if directioncount == 0:
|
||||||
move_and_collide(movement * 2)
|
direction = MOVEMENT_VECTORS[randi() % 4]
|
||||||
|
directioncount = (directioncount + 1) % 5
|
||||||
|
move_and_collide(direction * 2)
|
||||||
|
|
||||||
func _on_Hurtbox_area_entered(_area):
|
func _on_Hurtbox_area_entered(_area):
|
||||||
$Hurtbox/death.play()
|
$Hurtbox/death.play()
|
||||||
|
@ -11,14 +11,19 @@ const MOVEMENT_VECTORS = [
|
|||||||
Vector2.LEFT
|
Vector2.LEFT
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var directioncount = 0
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if position != null:
|
if position != null:
|
||||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||||
queue_free()
|
queue_free()
|
||||||
if immunity > 0:
|
if immunity > 0:
|
||||||
immunity = immunity - 1
|
immunity = immunity - 1
|
||||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
if directioncount == 0:
|
||||||
move_and_collide(movement * 2)
|
direction = MOVEMENT_VECTORS[randi() % 4]
|
||||||
|
directioncount = (directioncount + 1) % 5
|
||||||
|
move_and_collide(direction * 2)
|
||||||
|
|
||||||
func _on_Hurtbox_area_entered(_area):
|
func _on_Hurtbox_area_entered(_area):
|
||||||
if immunity == 0:
|
if immunity == 0:
|
||||||
|
@ -10,15 +10,20 @@ const MOVEMENT_VECTORS = [
|
|||||||
Vector2.DOWN,
|
Vector2.DOWN,
|
||||||
Vector2.LEFT
|
Vector2.LEFT
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var directioncount = 0
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if position != null:
|
if position != null:
|
||||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||||
queue_free()
|
queue_free()
|
||||||
if immunity > 0:
|
if immunity > 0:
|
||||||
immunity = immunity - 1
|
immunity = immunity - 1
|
||||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
if directioncount == 0:
|
||||||
move_and_collide(movement * 2)
|
direction = MOVEMENT_VECTORS[randi() % 4]
|
||||||
|
directioncount = (directioncount + 1) % 5
|
||||||
|
move_and_collide(direction * 2)
|
||||||
|
|
||||||
func _on_Hurtbox_area_entered(_area):
|
func _on_Hurtbox_area_entered(_area):
|
||||||
if immunity == 0:
|
if immunity == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user