forked from team-sg/hero-mark-2
add falling block
This commit is contained in:
parent
d6547b61d4
commit
54f0880864
20 changed files with 153 additions and 26 deletions
16
objects/environment/rock/rock.gd
Normal file
16
objects/environment/rock/rock.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends KinematicBody2D
|
||||
var velocity = Vector2.ZERO
|
||||
onready var bottom = $Bottom
|
||||
|
||||
func _physics_process(delta):
|
||||
if !is_on_floor():
|
||||
#Gravity
|
||||
velocity.y = 100
|
||||
velocity.x = 0
|
||||
else:
|
||||
velocity.y = 0
|
||||
move_and_slide(velocity,Vector2.UP)
|
||||
velocity.x = 0
|
||||
|
||||
func push(direction):
|
||||
velocity -= direction * 32
|
Loading…
Add table
Add a link
Reference in a new issue