graphics!

This commit is contained in:
stevensoroka 2025-08-18 21:05:53 -04:00
parent 9f023c62fb
commit 37cc95175e
No known key found for this signature in database
15 changed files with 470 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://gxrisb2pumwx"
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://4oa6xl7tm56k"
path="res://.godot/imported/player jump 48x48.png-3f2379396c4ee38ba6753cc20f4cda5f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/player jump 48x48.png"
dest_files=["res://.godot/imported/player jump 48x48.png-3f2379396c4ee38ba6753cc20f4cda5f.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://c0l386i2sd30n"
path="res://.godot/imported/player run 48x48.png-4e5c2e528c7b19ebc1c564af14e0dedd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/player run 48x48.png"
dest_files=["res://.godot/imported/player run 48x48.png-4e5c2e528c7b19ebc1c564af14e0dedd.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://lqv0pjykcj6s"
path="res://.godot/imported/Terrain (32x32).png-292d6fa2ee5cc5dcecc7573221274b3d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/tilemaps/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-292d6fa2ee5cc5dcecc7573221274b3d.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

@ -8,6 +8,7 @@ height = 32.0
[node name="bullet" type="Area2D"]
script = ExtResource("1_mkf8s")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.55509

View File

@ -1,13 +1,69 @@
[gd_scene load_steps=8 format=3 uid="uid://bjk7nrcwo0ikb"]
[gd_scene load_steps=11 format=4 uid="uid://bjk7nrcwo0ikb"]
[ext_resource type="Script" uid="uid://bc6rpr127gn6l" path="res://scripts/gamecontroller.gd" id="1_lnu2h"]
[ext_resource type="PackedScene" uid="uid://cm72yvkbgso3" path="res://scenes/crate.tscn" id="2_lbhrr"]
[ext_resource type="PackedScene" uid="uid://bbg4idgjqm8wr" path="res://scenes/player.tscn" id="2_lnu2h"]
[ext_resource type="Script" uid="uid://slrv7nc7hjkl" path="res://scripts/scene_manager.gd" id="2_p57ef"]
[ext_resource type="PackedScene" uid="uid://d1gmq2hler2x3" path="res://scenes/trigger.tscn" id="2_yqjtg"]
[ext_resource type="Texture2D" uid="uid://lqv0pjykcj6s" path="res://assets/graphics/tilemaps/Terrain (32x32).png" id="3_p57ef"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u5sy4"]
texture = ExtResource("3_p57ef")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
4:0/0 = 0
6:0/0 = 0
7:0/0 = 0
9:0/0 = 0
10:0/0 = 0
12:0/0 = 0
13:0/0 = 0
15:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
4:1/0 = 0
6:1/0 = 0
7:1/0 = 0
9:1/0 = 0
10:1/0 = 0
12:1/0 = 0
13:1/0 = 0
15:1/0 = 0
16:1/0 = 0
0:2/0 = 0
1:2/0 = 0
2:2/0 = 0
4:2/0 = 0
6:3/0 = 0
7:3/0 = 0
9:3/0 = 0
10:3/0 = 0
12:3/0 = 0
13:3/0 = 0
15:3/0 = 0
16:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
4:4/0 = 0
6:4/0 = 0
7:4/0 = 0
9:4/0 = 0
10:4/0 = 0
12:4/0 = 0
13:4/0 = 0
15:4/0 = 0
16:4/0 = 0
[sub_resource type="TileSet" id="TileSet_gee14"]
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_u5sy4")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
size = Vector2(66, 20)
size = Vector2(83, 20)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_8cj0n"]
distance = 15.0
@ -19,11 +75,17 @@ script = ExtResource("1_lnu2h")
unique_name_in_owner = true
script = ExtResource("2_p57ef")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
texture_filter = 1
tile_map_data = PackedByteArray("AAAFAAQAAAAAAAAAAAAGAAQAAAABAAAAAAAHAAQAAAACAAAAAAAFAAUAAAAAAAEAAAAFAAYAAAAAAAIAAAAGAAUAAAABAAEAAAAGAAYAAAABAAIAAAAHAAUAAAACAAEAAAAHAAYAAAACAAIAAAA=")
tile_set = SubResource("TileSet_gee14")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
position = Vector2(205, 132)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
position = Vector2(2.5, 7)
shape = SubResource("RectangleShape2D_8cj0n")
[node name="crate" parent="." instance=ExtResource("2_lbhrr")]
@ -39,7 +101,18 @@ shape = SubResource("WorldBoundaryShape2D_8cj0n")
[node name="Player" parent="." instance=ExtResource("2_lnu2h")]
position = Vector2(210, 92)
[node name="Area2D" parent="." instance=ExtResource("2_yqjtg")]
[node name="crate2" parent="." instance=ExtResource("2_lbhrr")]
position = Vector2(170, -30)
[node name="crate3" parent="." instance=ExtResource("2_lbhrr")]
position = Vector2(446, -170)
[node name="crate4" parent="." instance=ExtResource("2_lbhrr")]
position = Vector2(274, -216)
[node name="triggers" type="Node2D" parent="."]
[node name="player_hurt" parent="triggers" instance=ExtResource("2_yqjtg")]
position = Vector2(1106, 604)
[connection signal="areaTriggerSignal" from="Area2D" to="." method="_on_area_2d_area_trigger_signal"]
[connection signal="areaTriggerSignal" from="triggers/player_hurt" to="." method="_on_area_2d_area_trigger_signal"]

View File

@ -1,11 +1,185 @@
[gd_scene load_steps=3 format=3 uid="uid://bbg4idgjqm8wr"]
[gd_scene load_steps=28 format=3 uid="uid://bbg4idgjqm8wr"]
[ext_resource type="Script" uid="uid://r3vurapv33hu" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://4oa6xl7tm56k" path="res://assets/graphics/player/player jump 48x48.png" id="2_dqkch"]
[ext_resource type="Texture2D" uid="uid://gxrisb2pumwx" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_g2els"]
[ext_resource type="Texture2D" uid="uid://c0l386i2sd30n" path="res://assets/graphics/player/player run 48x48.png" id="3_qhqgy"]
[sub_resource type="CircleShape2D" id="CircleShape2D_8cj0n"]
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
atlas = ExtResource("2_dqkch")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
atlas = ExtResource("2_g2els")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
atlas = ExtResource("2_g2els")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
atlas = ExtResource("2_g2els")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_g2els")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
atlas = ExtResource("2_g2els")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
atlas = ExtResource("2_g2els")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
atlas = ExtResource("2_g2els")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
atlas = ExtResource("2_g2els")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
atlas = ExtResource("2_g2els")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
atlas = ExtResource("2_dqkch")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
atlas = ExtResource("2_dqkch")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
atlas = ExtResource("3_qhqgy")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
atlas = ExtResource("3_qhqgy")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
atlas = ExtResource("3_qhqgy")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
atlas = ExtResource("3_qhqgy")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
atlas = ExtResource("3_qhqgy")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"]
atlas = ExtResource("3_qhqgy")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"]
atlas = ExtResource("3_qhqgy")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"]
atlas = ExtResource("3_qhqgy")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_jej6c"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i4ail")
}],
"loop": false,
"name": &"fall",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qhqgy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dqkch")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qlg0r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tuyoq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fjrip")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_smehm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ur7pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d2wvv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3v2ag")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_a38lo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4ni07")
}],
"loop": false,
"name": &"jump",
"speed": 3.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jej6c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ej7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oprun")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a8ls1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qfm1y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fulsm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4r5pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_60mlk")
}],
"loop": true,
"name": &"run",
"speed": 5.0
}]
[node name="Player" type="CharacterBody2D"]
script = ExtResource("1_3vyb7")
acceleration = 20
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@ -23,3 +197,18 @@ position = Vector2(13, -6)
[node name="BulletSpawnPointLeft" type="Node2D" parent="."]
position = Vector2(-14, -6)
[node name="JumpBufferTimer" type="Timer" parent="."]
wait_time = 0.1
one_shot = true
[node name="PlayerAnimation" type="AnimatedSprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -6)
sprite_frames = SubResource("SpriteFrames_jej6c")
animation = &"jump"
autoplay = "idle"
frame = 1
frame_progress = 1.0
[connection signal="animation_finished" from="PlayerAnimation" to="." method="_on_animation_finished"]

View File

@ -1,5 +1,6 @@
extends Node2D
signal playerDamage
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -14,7 +15,10 @@ func _process(delta: float) -> void:
func _on_area_2d_area_trigger_signal(effect: String, body: Node2D) -> void:
if body.name == "world-boundary":
return
if body is Player:
if body is Player && effect == "player_hurt":
playerDamage.emit()
body.health -= 1
print(body.health)
return
print("GC sees trigger " + effect + " on " + body.name)
body.queue_free()

View File

@ -6,13 +6,20 @@ const bullet_scene = preload("res://scenes/bullet.tscn")
@onready var left_cast: RayCast2D = $LeftCast
@onready var bullet_spawn_point_right: Node2D = $BulletSpawnPointRight
@onready var bullet_spawn_point_left: Node2D = $BulletSpawnPointLeft
@onready var jump_buffer_timer: Timer = $JumpBufferTimer
@onready var player_animation: AnimatedSprite2D = $PlayerAnimation
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
const PUSH_POWER= 2000
@export var acceleration: int = 5
@export var health: int = 100
var direction: float
enum FaceDirection{LEFT, RIGHT}
enum State{IDLE, RUN, JUMP, FALL}
var state: State = State.IDLE
var facing: FaceDirection = FaceDirection.RIGHT
var pushTarget: Object
var pushEnabled: bool = false
@ -20,6 +27,8 @@ var pushEnabled: bool = false
func _physics_process(delta: float) -> void:
handle_input(delta)
handle_movement(delta)
handle_state(delta)
handle_animation(delta)
handle_collisions(delta)
func handle_gravity(delta: float) -> void:
@ -35,15 +44,17 @@ func handle_input(delta: float) -> void:
FaceDirection.RIGHT:
dir = 1
if Input.is_action_just_pressed("ui_accept"):
jump_buffer_timer.start()
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
direction = Input.get_axis("ui_left", "ui_right")
if direction < 0:
facing = FaceDirection.LEFT
elif direction > 0:
facing = FaceDirection.RIGHT
player_animation.flip_h = facing == FaceDirection.LEFT
if Input.is_action_just_pressed("ForcePush") && pushEnabled:
(pushTarget as RigidBody2D).apply_central_impulse(Vector2(dir, 0) * PUSH_POWER)
@ -64,10 +75,19 @@ func handle_movement(delta: float) -> void:
handle_gravity(delta)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
if direction:
velocity.x = direction * SPEED
if direction == 0:
# not moving
velocity.x = move_toward(velocity.x, 0, acceleration)
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.x = move_toward(velocity.x, SPEED * direction, acceleration)
if jump_buffer_timer.time_left > 0 and is_on_floor():
velocity.y = JUMP_VELOCITY
jump_buffer_timer.stop()
upJump = true
state = State.JUMP
move_and_slide()
func handle_collisions(delta: float) -> void:
@ -89,3 +109,31 @@ func handle_collisions(delta: float) -> void:
else:
pushEnabled = false
pushTarget = null
func handle_state(delta: float) -> void:
match state:
State.IDLE when velocity.x != 0:
state = State.RUN
if velocity.y > 0:
state = State.FALL
if velocity.y == 0 && velocity.x == 0:
state = State.IDLE
elif velocity.y == 0:
state = State.RUN
func handle_animation(delta: float) -> void:
match state:
State.IDLE:
player_animation.play("idle")
State.RUN:
player_animation.play("run")
State.JUMP:
if upJump:
player_animation.play("jump")
upJump = false
State.FALL:
player_animation.play("fall")
var upJump: bool = false
#func _on_animation_finished() -> void:

View File

@ -2,11 +2,18 @@ class_name SceneManager extends Node2D
const BulletScn = preload("res://scenes/bullet.tscn")
@onready var game: Node2D = $".."
@onready var triggers: Node2D = $"../triggers"
var bullets: Array[Bullet] = []
const MAX_BULLETS = 10
var current_bullet = 0
func _ready() -> void:
if triggers:
for obj in triggers.get_children():
if obj is Trigger:
obj.areaTriggerSignal.connect(game._on_area_2d_area_trigger_signal)
# makes and recycles bullets
func bulletFactory() -> Bullet:
if len(bullets) < MAX_BULLETS:

View File

@ -1,4 +1,4 @@
extends Area2D
class_name Trigger extends Area2D
@export var effect := "destroy"