diff --git a/Tiles/Inner.png b/Tiles/Inner.png new file mode 100644 index 0000000..a07be97 Binary files /dev/null and b/Tiles/Inner.png differ diff --git a/Tiles/Overworld.png b/Tiles/Overworld.png new file mode 100644 index 0000000..c03c380 Binary files /dev/null and b/Tiles/Overworld.png differ diff --git a/Tiles/cave.png b/Tiles/cave.png new file mode 100644 index 0000000..1df7b3e Binary files /dev/null and b/Tiles/cave.png differ diff --git a/Tiles/objects.png b/Tiles/objects.png new file mode 100644 index 0000000..f76813f Binary files /dev/null and b/Tiles/objects.png differ diff --git a/main character.gd b/main character.gd new file mode 100644 index 0000000..a58f9ea --- /dev/null +++ b/main character.gd @@ -0,0 +1,34 @@ +extends CharacterBody2D + + +const SPEED = 100.0 + + +func _physics_process(delta: float) -> void: + var direction := Input.get_axis("left", "right") + var updownDirection:=Input.get_axis("up","down") + if direction: + velocity.x = direction * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + if updownDirection: + velocity.y = updownDirection *SPEED + else: + velocity.y = move_toward(velocity.y,0,SPEED) + animation(direction,updownDirection) + move_and_slide() + + +func animation(directionX,directionY): + if directionX == 0 and directionY == 0: + $"AnimatedSprite2D".set_frame(0) + $"AnimatedSprite2D".pause() + if directionX < 0: + $"AnimatedSprite2D".play("WalkLeft") + elif directionX > 0: + $"AnimatedSprite2D".play("WalkRight") + if directionY > 0 and directionX == 0: + $"AnimatedSprite2D".play("WalkDown") + elif directionY < 0 and directionX ==0: + $"AnimatedSprite2D".play("WalkUp") +