tilemap working
This commit is contained in:
1 parent
37d2af3eb0
commit
0d0b2c4dea
11 files changed
+426
-69
No files matched your search
@@ -17,6 +17,7 @@ var pushLeftEnabled = false
|
||||
var pushRightEnabled = false
|
||||
var pushTarget
|
||||
|
||||
#preload bullet scene to be able to shoot it
|
||||
var bullet = preload("res://scenes/bullet.tscn")
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
@@ -40,14 +41,23 @@ func _physics_process(delta):
|
||||
pushLeftEnabled = false
|
||||
|
||||
if Input.is_action_just_pressed("shoot"):
|
||||
#make a bullet
|
||||
#make a bullet -- must be a scene in order to "instantiate"
|
||||
var myBullet = bullet.instantiate()
|
||||
#set bullet speed?
|
||||
|
||||
#put the bullet at the Marker
|
||||
#"owner" adds it to the character's parent node - the game scene
|
||||
owner.add_child(myBullet)
|
||||
myBullet.transform = marker_right.global_transform
|
||||
|
||||
#put the bullet at the Marker, specifically at its global coordinates
|
||||
if not faceLeft:
|
||||
#facing right
|
||||
myBullet.transform = marker_right.global_transform
|
||||
else:
|
||||
#facing left
|
||||
myBullet.transform = marker_left.global_transform
|
||||
myBullet.setSpeed(-750)
|
||||
pass
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var direction = Input.get_axis("ui_left", "ui_right")
|
||||
|
||||
Reference in new issue
Block a user