added npc to chat with
This commit is contained in:
1 parent
eaeed156cb
commit
588ced0110
12 files changed
+299
-188
No files matched your search
@@ -4,8 +4,3 @@ extends Node
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
@@ -0,0 +1,18 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
var playerInArea = false
|
||||
|
||||
func _input(event):
|
||||
if playerInArea && Input.is_action_pressed('select'):
|
||||
talk()
|
||||
|
||||
func talk():
|
||||
print('Hi friend!')
|
||||
|
||||
func _on_area_2d_body_entered(body):
|
||||
if body.name == 'player':
|
||||
playerInArea = true
|
||||
|
||||
func _on_area_2d_body_exited(body):
|
||||
if body.name == 'player':
|
||||
playerInArea = false
|
||||
@@ -0,0 +1 @@
|
||||
uid://bief2jignsvig
|
||||
+10
-10
@@ -1,19 +1,19 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
@onready var animationPlayer = $AnimatedSprite2D
|
||||
const SPEED = 175
|
||||
const SPEED = 150
|
||||
|
||||
func _process(_delta):
|
||||
velocity = Input.get_vector("moveLeft", "moveRight", "moveUp", "moveDown") * SPEED
|
||||
velocity = Input.get_vector('moveLeft', 'moveRight', 'moveUp', 'moveDown') * SPEED
|
||||
move_and_slide()
|
||||
|
||||
if Input.is_action_pressed("moveUp"):
|
||||
animationPlayer.play("walk_up")
|
||||
elif Input.is_action_pressed("moveDown"):
|
||||
animationPlayer.play("walk_down")
|
||||
elif Input.is_action_pressed("moveLeft"):
|
||||
animationPlayer.play("walk_left")
|
||||
elif Input.is_action_pressed("moveRight"):
|
||||
animationPlayer.play("walk_right")
|
||||
if Input.is_action_pressed('moveUp'):
|
||||
animationPlayer.play('walk_up')
|
||||
elif Input.is_action_pressed('moveDown'):
|
||||
animationPlayer.play('walk_down')
|
||||
elif Input.is_action_pressed('moveLeft'):
|
||||
animationPlayer.play('walk_left')
|
||||
elif Input.is_action_pressed('moveRight'):
|
||||
animationPlayer.play('walk_right')
|
||||
else:
|
||||
animationPlayer.stop()
|
||||
Reference in new issue
Block a user