Compare commits
10 commits
11a3d5d4f4
...
7826221624
Author | SHA1 | Date | |
---|---|---|---|
7826221624 | |||
b90a210913 | |||
6983001d45 | |||
5c52c04acb | |||
502d0c440d | |||
093f6eb94e | |||
2b8f5309f1 | |||
4efe49303d | |||
da9e5a88fc | |||
2cc7faea0e |
10 changed files with 249 additions and 57 deletions
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 42 KiB |
BIN
Assets/Textures/basic_enemy.png
Normal file
BIN
Assets/Textures/basic_enemy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 157 B |
34
Assets/Textures/basic_enemy.png.import
Normal file
34
Assets/Textures/basic_enemy.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dx5k5qa1pwbfl"
|
||||
path="res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Textures/basic_enemy.png"
|
||||
dest_files=["res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -28,7 +28,7 @@ texture = ExtResource("1")
|
|||
0:1/0/terrains_peering_bit/top_right_corner = 0
|
||||
0:2/size_in_atlas = Vector2i(1, 2)
|
||||
0:2/0 = 0
|
||||
0:2/0/texture_offset = Vector2i(0, -8)
|
||||
0:2/0/texture_origin = Vector2i(0, -8)
|
||||
0:2/0/terrain_set = 0
|
||||
0:2/0/terrain = 0
|
||||
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -40,7 +40,7 @@ texture = ExtResource("1")
|
|||
0:2/0/terrains_peering_bit/top_right_corner = 0
|
||||
1:2/size_in_atlas = Vector2i(1, 2)
|
||||
1:2/0 = 0
|
||||
1:2/0/texture_offset = Vector2i(0, -8)
|
||||
1:2/0/texture_origin = Vector2i(0, -8)
|
||||
1:2/0/terrain_set = 0
|
||||
1:2/0/terrain = 0
|
||||
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -99,7 +99,7 @@ texture = ExtResource("1")
|
|||
2:1/0/terrains_peering_bit/top_side = 0
|
||||
2:2/size_in_atlas = Vector2i(1, 2)
|
||||
2:2/0 = 0
|
||||
2:2/0/texture_offset = Vector2i(0, -8)
|
||||
2:2/0/texture_origin = Vector2i(0, -8)
|
||||
2:2/0/terrain_set = 0
|
||||
2:2/0/terrain = 0
|
||||
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -198,7 +198,7 @@ texture = ExtResource("1")
|
|||
5:1/0/terrains_peering_bit/top_side = 0
|
||||
5:2/size_in_atlas = Vector2i(1, 2)
|
||||
5:2/0 = 0
|
||||
5:2/0/texture_offset = Vector2i(0, -8)
|
||||
5:2/0/texture_origin = Vector2i(0, -8)
|
||||
5:2/0/terrain_set = 0
|
||||
5:2/0/terrain = 0
|
||||
5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -259,7 +259,7 @@ texture = ExtResource("1")
|
|||
7:1/0/terrains_peering_bit/left_side = 0
|
||||
7:2/size_in_atlas = Vector2i(1, 2)
|
||||
7:2/0 = 0
|
||||
7:2/0/texture_offset = Vector2i(0, -8)
|
||||
7:2/0/texture_origin = Vector2i(0, -8)
|
||||
7:2/0/terrain_set = 0
|
||||
7:2/0/terrain = 0
|
||||
7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -271,7 +271,7 @@ texture = ExtResource("1")
|
|||
7:2/0/terrains_peering_bit/top_side = 0
|
||||
6:2/size_in_atlas = Vector2i(1, 2)
|
||||
6:2/0 = 0
|
||||
6:2/0/texture_offset = Vector2i(0, -8)
|
||||
6:2/0/texture_origin = Vector2i(0, -8)
|
||||
6:2/0/terrain_set = 0
|
||||
6:2/0/terrain = 0
|
||||
6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -283,7 +283,7 @@ texture = ExtResource("1")
|
|||
6:2/0/terrains_peering_bit/top_side = 0
|
||||
19:2/size_in_atlas = Vector2i(1, 2)
|
||||
19:2/0 = 0
|
||||
19:2/0/texture_offset = Vector2i(0, -8)
|
||||
19:2/0/texture_origin = Vector2i(0, -8)
|
||||
19:2/0/terrain_set = 0
|
||||
19:2/0/terrain = 1
|
||||
19:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -295,7 +295,7 @@ texture = ExtResource("1")
|
|||
19:2/0/terrains_peering_bit/top_side = 1
|
||||
18:2/size_in_atlas = Vector2i(1, 2)
|
||||
18:2/0 = 0
|
||||
18:2/0/texture_offset = Vector2i(0, -8)
|
||||
18:2/0/texture_origin = Vector2i(0, -8)
|
||||
18:2/0/terrain_set = 0
|
||||
18:2/0/terrain = 1
|
||||
18:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -307,7 +307,7 @@ texture = ExtResource("1")
|
|||
18:2/0/terrains_peering_bit/top_side = 1
|
||||
17:2/size_in_atlas = Vector2i(1, 2)
|
||||
17:2/0 = 0
|
||||
17:2/0/texture_offset = Vector2i(0, -8)
|
||||
17:2/0/texture_origin = Vector2i(0, -8)
|
||||
17:2/0/terrain_set = 0
|
||||
17:2/0/terrain = 1
|
||||
17:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -344,7 +344,7 @@ texture = ExtResource("1")
|
|||
15:2/0/terrains_peering_bit/top_right_corner = 1
|
||||
14:2/size_in_atlas = Vector2i(1, 2)
|
||||
14:2/0 = 0
|
||||
14:2/0/texture_offset = Vector2i(0, -8)
|
||||
14:2/0/texture_origin = Vector2i(0, -8)
|
||||
14:2/0/terrain_set = 0
|
||||
14:2/0/terrain = 1
|
||||
14:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -382,7 +382,7 @@ texture = ExtResource("1")
|
|||
15:3/0/terrains_peering_bit/top_right_corner = 1
|
||||
13:2/size_in_atlas = Vector2i(1, 2)
|
||||
13:2/0 = 0
|
||||
13:2/0/texture_offset = Vector2i(0, -8)
|
||||
13:2/0/texture_origin = Vector2i(0, -8)
|
||||
13:2/0/terrain_set = 0
|
||||
13:2/0/terrain = 1
|
||||
13:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -395,7 +395,7 @@ texture = ExtResource("1")
|
|||
13:2/0/terrains_peering_bit/top_right_corner = 1
|
||||
12:2/size_in_atlas = Vector2i(1, 2)
|
||||
12:2/0 = 0
|
||||
12:2/0/texture_offset = Vector2i(0, -8)
|
||||
12:2/0/texture_origin = Vector2i(0, -8)
|
||||
12:2/0/terrain_set = 0
|
||||
12:2/0/terrain = 1
|
||||
12:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -559,7 +559,7 @@ texture = ExtResource("1")
|
|||
12:1/0/terrains_peering_bit/top_right_corner = 1
|
||||
8:2/size_in_atlas = Vector2i(1, 2)
|
||||
8:2/0 = 0
|
||||
8:2/0/texture_offset = Vector2i(0, -8)
|
||||
8:2/0/texture_origin = Vector2i(0, -8)
|
||||
8:2/0/terrain_set = 0
|
||||
8:2/0/terrain = 0
|
||||
8:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -765,7 +765,7 @@ texture = ExtResource("1")
|
|||
20:1/0/terrains_peering_bit/top_side = 1
|
||||
20:2/size_in_atlas = Vector2i(1, 2)
|
||||
20:2/0 = 0
|
||||
20:2/0/texture_offset = Vector2i(0, -8)
|
||||
20:2/0/texture_origin = Vector2i(0, -8)
|
||||
20:2/0/terrain_set = 0
|
||||
20:2/0/terrain = 1
|
||||
20:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -874,7 +874,7 @@ texture = ExtResource("1")
|
|||
0:4/0/terrains_peering_bit/bottom_side = 0
|
||||
1:4/size_in_atlas = Vector2i(1, 2)
|
||||
1:4/0 = 0
|
||||
1:4/0/texture_offset = Vector2i(0, -8)
|
||||
1:4/0/texture_origin = Vector2i(0, -8)
|
||||
1:4/0/terrain_set = 0
|
||||
1:4/0/terrain = 0
|
||||
1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -883,7 +883,7 @@ texture = ExtResource("1")
|
|||
1:4/0/terrains_peering_bit/top_side = 0
|
||||
2:4/size_in_atlas = Vector2i(1, 2)
|
||||
2:4/0 = 0
|
||||
2:4/0/texture_offset = Vector2i(0, -8)
|
||||
2:4/0/texture_origin = Vector2i(0, -8)
|
||||
2:4/0/terrain_set = 0
|
||||
2:4/0/terrain = 0
|
||||
2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -892,7 +892,7 @@ texture = ExtResource("1")
|
|||
2:4/0/terrains_peering_bit/right_side = 0
|
||||
3:4/size_in_atlas = Vector2i(1, 2)
|
||||
3:4/0 = 0
|
||||
3:4/0/texture_offset = Vector2i(0, -8)
|
||||
3:4/0/texture_origin = Vector2i(0, -8)
|
||||
3:4/0/terrain_set = 0
|
||||
3:4/0/terrain = 0
|
||||
3:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -912,7 +912,7 @@ texture = ExtResource("1")
|
|||
4:4/0/terrains_peering_bit/left_side = 0
|
||||
5:4/size_in_atlas = Vector2i(1, 2)
|
||||
5:4/0 = 0
|
||||
5:4/0/texture_offset = Vector2i(0, -8)
|
||||
5:4/0/texture_origin = Vector2i(0, -8)
|
||||
5:4/0/terrain_set = 0
|
||||
5:4/0/terrain = 0
|
||||
5:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -954,7 +954,7 @@ texture = ExtResource("1")
|
|||
12:4/0/terrains_peering_bit/bottom_side = 1
|
||||
13:4/size_in_atlas = Vector2i(1, 2)
|
||||
13:4/0 = 0
|
||||
13:4/0/texture_offset = Vector2i(0, -8)
|
||||
13:4/0/texture_origin = Vector2i(0, -8)
|
||||
13:4/0/terrain_set = 0
|
||||
13:4/0/terrain = 1
|
||||
13:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -963,7 +963,7 @@ texture = ExtResource("1")
|
|||
13:4/0/terrains_peering_bit/top_side = 1
|
||||
14:4/size_in_atlas = Vector2i(1, 2)
|
||||
14:4/0 = 0
|
||||
14:4/0/texture_offset = Vector2i(0, -8)
|
||||
14:4/0/texture_origin = Vector2i(0, -8)
|
||||
14:4/0/terrain_set = 0
|
||||
14:4/0/terrain = 1
|
||||
14:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -972,7 +972,7 @@ texture = ExtResource("1")
|
|||
14:4/0/terrains_peering_bit/right_side = 1
|
||||
15:4/size_in_atlas = Vector2i(1, 2)
|
||||
15:4/0 = 0
|
||||
15:4/0/texture_offset = Vector2i(0, -8)
|
||||
15:4/0/texture_origin = Vector2i(0, -8)
|
||||
15:4/0/terrain_set = 0
|
||||
15:4/0/terrain = 1
|
||||
15:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -992,7 +992,7 @@ texture = ExtResource("1")
|
|||
16:4/0/terrains_peering_bit/left_side = 1
|
||||
17:4/size_in_atlas = Vector2i(1, 2)
|
||||
17:4/0 = 0
|
||||
17:4/0/texture_offset = Vector2i(0, -8)
|
||||
17:4/0/texture_origin = Vector2i(0, -8)
|
||||
17:4/0/terrain_set = 0
|
||||
17:4/0/terrain = 1
|
||||
17:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -1140,7 +1140,7 @@ texture = ExtResource("1")
|
|||
0:6/0/terrains_peering_bit/left_side = 0
|
||||
1:6/size_in_atlas = Vector2i(1, 2)
|
||||
1:6/0 = 0
|
||||
1:6/0/texture_offset = Vector2i(0, -8)
|
||||
1:6/0/texture_origin = Vector2i(0, -8)
|
||||
1:6/0/terrain_set = 0
|
||||
1:6/0/terrain = 0
|
||||
1:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -1178,7 +1178,7 @@ texture = ExtResource("1")
|
|||
4:6/0/terrains_peering_bit/left_side = 0
|
||||
5:6/size_in_atlas = Vector2i(1, 2)
|
||||
5:6/0 = 0
|
||||
5:6/0/texture_offset = Vector2i(0, -8)
|
||||
5:6/0/texture_origin = Vector2i(0, -8)
|
||||
5:6/0/terrain_set = 0
|
||||
5:6/0/terrain = 0
|
||||
5:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -1216,7 +1216,7 @@ texture = ExtResource("1")
|
|||
12:6/0/terrains_peering_bit/left_side = 1
|
||||
13:6/size_in_atlas = Vector2i(1, 2)
|
||||
13:6/0 = 0
|
||||
13:6/0/texture_offset = Vector2i(0, -8)
|
||||
13:6/0/texture_origin = Vector2i(0, -8)
|
||||
13:6/0/terrain_set = 0
|
||||
13:6/0/terrain = 1
|
||||
13:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -1254,7 +1254,7 @@ texture = ExtResource("1")
|
|||
16:6/0/terrains_peering_bit/left_side = 1
|
||||
17:6/size_in_atlas = Vector2i(1, 2)
|
||||
17:6/0 = 0
|
||||
17:6/0/texture_offset = Vector2i(0, -8)
|
||||
17:6/0/texture_origin = Vector2i(0, -8)
|
||||
17:6/0/terrain_set = 0
|
||||
17:6/0/terrain = 1
|
||||
17:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
|
@ -1804,6 +1804,7 @@ texture = ExtResource("1")
|
|||
|
||||
[resource]
|
||||
physics_layer_0/collision_layer = 1
|
||||
physics_layer_0/collision_mask = 0
|
||||
terrain_set_0/mode = 0
|
||||
terrain_set_0/terrain_0/name = "Colony Blue"
|
||||
terrain_set_0/terrain_0/color = Color(0, 0.384314, 0.721569, 1)
|
||||
|
|
15
README.md
15
README.md
|
@ -1,12 +1,25 @@
|
|||
# 2DHackAndSlay
|
||||
|
||||
## Branches
|
||||
|
||||
- [stable](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/stable) - This is the Most stable branch and only will get PRs from [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly)
|
||||
- [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly) - This Branch will only get PRs from [dev-base](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/dev-base)its meant for testing
|
||||
- [dev-base](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/dev-base) - On This branch the Diffrent dev branches will be merged and code may be written to combine everything. when this branch is at a somewhat stable branch it gets a PR to [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly)
|
||||
- dev-* - Dev branches with their respective goal which will be merged into dev-base
|
||||
|
||||
## Code Linting Rules
|
||||
### Use Tabs
|
||||
Tabs are just cooler
|
||||
|
||||
### Use Sign-Form instead of Text-Form
|
||||
|
||||
#### Why
|
||||
There are a lot of Operators in godot, and most are based around signs, so for consistency we stay at the Sign-Forms
|
||||
|
||||
#### Boolean operators
|
||||
- `&&` instead of `and`
|
||||
- `||` instead of `or`
|
||||
- `!` instead of `not`
|
||||
|
||||
## Resources used:
|
||||
|
||||
### Game Art
|
||||
|
|
File diff suppressed because one or more lines are too long
107
Scripts/Enemy/EnemyController.gd
Normal file
107
Scripts/Enemy/EnemyController.gd
Normal file
|
@ -0,0 +1,107 @@
|
|||
extends Node2D
|
||||
|
||||
@export_group("Movement Properties")
|
||||
@export var speed = 25
|
||||
@export var turn_speed = 25
|
||||
|
||||
@export_group("Vision Properties")
|
||||
@export var ray : RayCast2D
|
||||
@export_flags_2d_physics var player_collision_layer := 2
|
||||
@export var max_view_distance := 50
|
||||
@export_range(0.0, 360.0) var angle_cone_of_vision : float = 120
|
||||
@export_range(0, 72) var sweeping_steps : int = 24
|
||||
@export var debug_vision := false
|
||||
|
||||
enum STATES {
|
||||
IDLE,
|
||||
TARGETING
|
||||
}
|
||||
|
||||
var state : STATES
|
||||
|
||||
# Only used for Debugging purposes right now
|
||||
var player_positions : Array
|
||||
|
||||
func _ready():
|
||||
# Set Raycast into view Direction
|
||||
ray.target_position = Vector2(max_view_distance, 0)
|
||||
pass
|
||||
|
||||
func swipe_view():
|
||||
# Set Raycast to starting position
|
||||
ray.rotation_degrees = -angle_cone_of_vision / 2
|
||||
|
||||
# Create Array to Store Angles of Hits
|
||||
var hit_angles : Array
|
||||
|
||||
# Clear Player Positions Array
|
||||
player_positions.clear()
|
||||
|
||||
for step in sweeping_steps + 1:
|
||||
# Check Ray
|
||||
ray.force_raycast_update()
|
||||
if ray.is_colliding():
|
||||
# Get Collider
|
||||
var collider = ray.get_collider()
|
||||
var collider_class = collider.get_class()
|
||||
var collision_layer : int
|
||||
|
||||
# Get Collision Layer
|
||||
if collider_class == "TileMap":
|
||||
collider = collider as TileMap
|
||||
collision_layer = collider.tile_set.get_physics_layer_collision_layer(0)
|
||||
else:
|
||||
collision_layer = collider.get_collision_layer()
|
||||
|
||||
# Checking Collision Layer
|
||||
if collision_layer & player_collision_layer > 0:
|
||||
hit_angles.append(ray.rotation_degrees)
|
||||
player_positions.append(to_local(ray.get_collision_point()))
|
||||
# Rotate Ray
|
||||
ray.rotation_degrees += angle_cone_of_vision / sweeping_steps
|
||||
return hit_angles
|
||||
|
||||
func look_at_player(delta : float):
|
||||
# Get All Angles at which the Player can be seen
|
||||
var hit_angles = swipe_view()
|
||||
|
||||
# If The Player cant be seen, return and do nothing
|
||||
if hit_angles.size() <= 0:
|
||||
state = STATES.IDLE
|
||||
return
|
||||
state = STATES.TARGETING
|
||||
|
||||
# Calculate Average Angle Of Player
|
||||
var average_angle : float
|
||||
for angle in hit_angles:
|
||||
average_angle += angle
|
||||
average_angle /= hit_angles.size()
|
||||
|
||||
# Rotate towards Player, but limit it by rotation speed
|
||||
self.rotation_degrees += clampf(average_angle, -2 * PI * delta * turn_speed, 2 * PI * delta * turn_speed)
|
||||
pass
|
||||
|
||||
func _physics_process(delta):
|
||||
look_at_player(delta)
|
||||
pass
|
||||
|
||||
func _draw():
|
||||
# Draw a Debug Arc in case that Debug Vision is enabled
|
||||
if debug_vision:
|
||||
|
||||
# Draw All Ray Positions
|
||||
var angle = -angle_cone_of_vision / 2
|
||||
for step in sweeping_steps + 1:
|
||||
self.draw_line(Vector2(), Vector2(max_view_distance,0).rotated(deg_to_rad(angle)), Color.DARK_RED, 0.5, false)
|
||||
angle += angle_cone_of_vision / sweeping_steps
|
||||
|
||||
# Draw Ray Arc
|
||||
self.draw_arc(Vector2(), max_view_distance, deg_to_rad(-angle_cone_of_vision / 2), deg_to_rad(angle_cone_of_vision / 2), sweeping_steps + 1, Color.RED, 0.5, false)
|
||||
|
||||
# Draw A Circle Around the Player if hes seen
|
||||
if state == STATES.TARGETING:
|
||||
for pos in player_positions:
|
||||
self.draw_circle(pos, 4, Color.ORANGE_RED)
|
||||
queue_redraw()
|
||||
pass
|
||||
|
16
Scripts/Player/PlayerController.gd
Normal file
16
Scripts/Player/PlayerController.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 50
|
||||
|
||||
func get_move_vector():
|
||||
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down").normalized()
|
||||
return input_direction
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
# Set Velcoity to Move Vector times speed
|
||||
self.velocity = get_move_vector() * speed
|
||||
# Do the Physics-Calculations of the Player
|
||||
self.move_and_slide()
|
||||
pass
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 50
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func get_input():
|
||||
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
velocity = input_direction * speed
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta):
|
||||
get_input()
|
||||
move_and_slide()
|
||||
|
||||
|
|
@ -65,6 +65,12 @@ do_shake={
|
|||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="Map"
|
||||
2d_physics/layer_2="Player"
|
||||
2d_physics/layer_3="Enemys"
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
|
Reference in a new issue