bullet hell
This commit is contained in:
parent
499b2416e1
commit
cef1d348d4
6 changed files with 107 additions and 10 deletions
28
games/bullet_hell/bulletHellMovement.gd
Normal file
28
games/bullet_hell/bulletHellMovement.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var hDirection := Input.get_axis("hell_left", "hell_right")
|
||||
var vDirection := Input.get_axis("hell_up", "hell_down")
|
||||
if hDirection:
|
||||
velocity.x = hDirection * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
if vDirection:
|
||||
velocity.y = vDirection * SPEED
|
||||
else:
|
||||
velocity.y = move_toward(velocity.y, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
Loading…
Add table
Add a link
Reference in a new issue