resolve
This commit is contained in:
commit
aebad63fa3
43 changed files with 589 additions and 81 deletions
14
gmtk_2024/scripts/enemy_movement_mover.gd
Normal file
14
gmtk_2024/scripts/enemy_movement_mover.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 200;
|
||||
@export var gravity = 50;
|
||||
|
||||
var direction = 1;
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_on_wall():
|
||||
direction = direction * -1
|
||||
velocity.x = direction * speed
|
||||
velocity.y += gravity
|
||||
move_and_slide()
|
|
@ -3,7 +3,7 @@ extends CharacterBody2D
|
|||
@export var speed = 340;
|
||||
@export var gravity = 50;
|
||||
@export var jump_count = 2;
|
||||
@export var jump_strength = 700;
|
||||
@export var jump_strength = 100
|
||||
|
||||
var jump_count_current = 2;
|
||||
var input_direction = 0 #To keep track of which direction we where moving in last frame
|
||||
|
@ -24,14 +24,16 @@ func get_input():
|
|||
|
||||
velocity.x = input_direction * speed
|
||||
|
||||
if is_on_floor(): # rest the jump count
|
||||
jump_count_current = jump_count
|
||||
|
||||
if Input.is_action_just_pressed("player_jump") and jump_count_current > 0:
|
||||
velocity.y = -1 * jump_strength
|
||||
jump_count_current = jump_count_current-1
|
||||
elif Input.is_action_pressed("player_jump"): #Fall less fast if we keep holding the button
|
||||
velocity.y += -1 * 20
|
||||
velocity.y += -1 * 25
|
||||
|
||||
if is_on_floor():
|
||||
jump_count_current = jump_count
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
get_input()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue