tilemaps sprite sheets animated sprites

This commit is contained in:
fabianainu 2024-12-02 20:49:40 -05:00
parent 74561cfb2f
commit 795d183025
19 changed files with 580 additions and 32 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b74qeqtivdkpc"
path="res://.godot/imported/crate.png-a8589d0a814f9d7cb0facb9c1c1d5fda.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/crate.png"
dest_files=["res://.godot/imported/crate.png-a8589d0a814f9d7cb0facb9c1c1d5fda.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://qftgnypwbikp"
path="res://.godot/imported/Terrain (32x32).png-81a713b69add642b2640197ae95d1555.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/terrain/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-81a713b69add642b2640197ae95d1555.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dvgh32yadcjcq"
path="res://.godot/imported/Player Idle 48x48.png-9f43f14976963a2821a06ddf8579a76a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/idle/Player Idle 48x48.png"
dest_files=["res://.godot/imported/Player Idle 48x48.png-9f43f14976963a2821a06ddf8579a76a.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cwiun1ntuu02d"
path="res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/jump/player jump 48x48.png"
dest_files=["res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2mxlso64vnrk"
path="res://.godot/imported/player run 48x48.png-6d66612d48bfa4c8721495ba557ab7c6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/run/player run 48x48.png"
dest_files=["res://.godot/imported/player run 48x48.png-6d66612d48bfa4c8721495ba557ab7c6.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chjhyldrqmyfi"
path="res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/projectiles/pixel_bullet.png"
dest_files=["res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.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

View File

@ -15,9 +15,18 @@ run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[display]
window/size/viewport_width=320
window/size/viewport_height=180
window/size/window_width_override=960
window/size/window_height_override=540
window/stretch/mode="viewport"
[file_customization] [file_customization]
folder_colors={ folder_colors={
"res://assets/": "yellow",
"res://scripts/": "green" "res://scripts/": "green"
} }

View File

@ -1,13 +1,19 @@
[gd_scene load_steps=2 format=3 uid="uid://bw3gps1njvtgr"] [gd_scene load_steps=3 format=3 uid="uid://bw3gps1njvtgr"]
[ext_resource type="Texture2D" uid="uid://b74qeqtivdkpc" path="res://assets/graphics/crate.png" id="1_nsnd2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ddwss"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ddwss"]
size = Vector2(26, 26) size = Vector2(26, 26)
[node name="RigidBody2D" type="RigidBody2D" groups=["box"]] [node name="RigidBody2D" type="RigidBody2D" groups=["box"]]
position = Vector2(411, 384)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = -0.802465
shape = SubResource("RectangleShape2D_ddwss") shape = SubResource("RectangleShape2D_ddwss")
debug_color = Color(0.848428, 0.374869, 0, 0.42) debug_color = Color(0.848428, 0.374869, 0, 0.42)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, 2)
scale = Vector2(0.095, 0.095)
texture = ExtResource("1_nsnd2")

View File

@ -1,15 +1,24 @@
[gd_scene load_steps=3 format=3 uid="uid://b2tgt64a7m32v"] [gd_scene load_steps=4 format=3 uid="uid://b2tgt64a7m32v"]
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_jag7h"] [ext_resource type="Script" path="res://scripts/bullet.gd" id="1_jag7h"]
[ext_resource type="Texture2D" uid="uid://chjhyldrqmyfi" path="res://assets/graphics/projectiles/pixel_bullet.png" id="2_fl8or"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_eswsk"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_eswsk"]
size = Vector2(7, 1) size = Vector2(5, 2)
[node name="Area2D" type="Area2D"] [node name="Area2D" type="Area2D"]
script = ExtResource("1_jag7h") script = ExtResource("1_jag7h")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, 0)
shape = SubResource("RectangleShape2D_eswsk") shape = SubResource("RectangleShape2D_eswsk")
debug_color = Color(0.827451, 1, 0, 0.419608) debug_color = Color(0.827451, 1, 0, 0.419608)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(-2, -1)
rotation = 3.14159
scale = Vector2(0.04, 0.04)
texture = ExtResource("2_fl8or")
[connection signal="body_entered" from="." to="." method="_on_body_entered"] [connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,15 +1,185 @@
[gd_scene load_steps=3 format=3 uid="uid://djgtbc1quqvwe"] [gd_scene load_steps=28 format=3 uid="uid://djgtbc1quqvwe"]
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_ay2gi"] [ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_ay2gi"]
[ext_resource type="Texture2D" uid="uid://dvgh32yadcjcq" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_5mbmt"]
[ext_resource type="Texture2D" uid="uid://2mxlso64vnrk" path="res://assets/graphics/player/run/player run 48x48.png" id="3_2y1a6"]
[ext_resource type="Texture2D" uid="uid://cwiun1ntuu02d" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5o14d"]
[sub_resource type="CircleShape2D" id="CircleShape2D_iice4"] [sub_resource type="CircleShape2D" id="CircleShape2D_iice4"]
radius = 6.32456 radius = 6.32456
[sub_resource type="AtlasTexture" id="AtlasTexture_1yv5c"]
atlas = ExtResource("2_5mbmt")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tlaeb"]
atlas = ExtResource("2_5mbmt")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_20pqf"]
atlas = ExtResource("2_5mbmt")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_2avsb"]
atlas = ExtResource("2_5mbmt")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_setfi"]
atlas = ExtResource("2_5mbmt")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_2kldi"]
atlas = ExtResource("2_5mbmt")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fksgv"]
atlas = ExtResource("2_5mbmt")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_71xob"]
atlas = ExtResource("2_5mbmt")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_mabyy"]
atlas = ExtResource("2_5mbmt")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_1npam"]
atlas = ExtResource("2_5mbmt")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_6celb"]
atlas = ExtResource("3_5o14d")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vfeof"]
atlas = ExtResource("3_5o14d")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_x5qk1"]
atlas = ExtResource("3_5o14d")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_aaf1m"]
atlas = ExtResource("3_2y1a6")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_yycch"]
atlas = ExtResource("3_2y1a6")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qesu5"]
atlas = ExtResource("3_2y1a6")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gminf"]
atlas = ExtResource("3_2y1a6")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_t50sr"]
atlas = ExtResource("3_2y1a6")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qmkn1"]
atlas = ExtResource("3_2y1a6")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_sgy1b"]
atlas = ExtResource("3_2y1a6")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_nc8cu"]
atlas = ExtResource("3_2y1a6")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_ck70u"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1yv5c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tlaeb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_20pqf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2avsb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_setfi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2kldi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fksgv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_71xob")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mabyy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1npam")
}],
"loop": true,
"name": &"Idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6celb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vfeof")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x5qk1")
}],
"loop": false,
"name": &"Jump",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_aaf1m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yycch")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qesu5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gminf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t50sr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qmkn1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sgy1b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nc8cu")
}],
"loop": true,
"name": &"Run",
"speed": 12.0
}]
[node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]] [node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]]
script = ExtResource("1_ay2gi") script = ExtResource("1_ay2gi")
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 2)
scale = Vector2(0.937476, 2.2372)
shape = SubResource("CircleShape2D_iice4") shape = SubResource("CircleShape2D_iice4")
debug_color = Color(0.598404, 0.370441, 1, 0.42) debug_color = Color(0.598404, 0.370441, 1, 0.42)
@ -25,3 +195,12 @@ position = Vector2(6, -5)
[node name="LeftTarget" type="Node2D" parent="."] [node name="LeftTarget" type="Node2D" parent="."]
position = Vector2(-6, -5) position = Vector2(-6, -5)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
scale = Vector2(1.00239, 0.967018)
sprite_frames = SubResource("SpriteFrames_ck70u")
animation = &"Idle"
autoplay = "Idle"
[node name="Camera2D" type="Camera2D" parent="."]

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
class_name Bullet extends Area2D class_name Bullet extends Area2D
@onready var bulletSprite: Sprite2D = $Sprite2D
var speed = 750 var speed = 750
# did I hit someone? # did I hit someone?
@ -6,6 +7,10 @@ signal hit(bullet, body)
func setSpeed(speedValue): func setSpeed(speedValue):
speed = speedValue speed = speedValue
if speed <0:
bulletSprite.flip_h = true
else:
bulletSprite.flip_h = false
func _physics_process(delta): func _physics_process(delta):
position += transform.x * speed * delta position += transform.x * speed * delta

View File

@ -2,17 +2,20 @@ extends CharacterBody2D
const SPEED = 300.0 const SPEED = 300.0
const JUMP_VELOCITY = -400.0 const JUMP_VELOCITY = -500.0
const BUMP_FORCE = 50 const BUMP_FORCE = 50
const PUSHFORCE = 750 const PUSHFORCE = 750
@onready var right_ray: RayCast2D = $RightRay @onready var right_ray: RayCast2D = $RightRay
@onready var left_ray: RayCast2D = $LeftRay @onready var left_ray: RayCast2D = $LeftRay
@onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D
var faceLeft = false var faceLeft = false
var pushTarget var pushTarget
var pushLefEnabled = false var pushLefEnabled = false
var pushRightEnabled = false var pushRightEnabled = false
var isJumping = false
@onready var right_target: Node2D = $RightTarget @onready var right_target: Node2D = $RightTarget
@onready var left_target: Node2D = $LeftTarget @onready var left_target: Node2D = $LeftTarget
@ -50,11 +53,29 @@ func _physics_process(delta: float) -> void:
if direction: if direction:
velocity.x = direction * SPEED velocity.x = direction * SPEED
if direction > 0: faceLeft = false if direction >0:
if direction < 0: faceLeft = true faceLeft = false
if direction <0:
faceLeft = true
else: else:
velocity.x = move_toward(velocity.x, 0, SPEED) velocity.x = move_toward(velocity.x, 0, SPEED)
if faceLeft:
playerSprite.flip_h = true
else:
playerSprite.flip_h = false
if is_on_floor():
isJumping = false
if direction == 0:
playerSprite.play("Idle")
else:
playerSprite.play("Run")
else:
if not isJumping:
playerSprite.play("Jump")
isJumping = true
move_and_slide() move_and_slide()
if right_ray.is_colliding(): if right_ray.is_colliding():
print("Something is on my right") print("Something is on my right")