added basic animation, SceneManager, and base for a trap

This commit is contained in:
bip 2024-09-16 21:13:05 -04:00
parent 0c164bff8a
commit e76bb75ec2
21 changed files with 572 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b80n7lhw6e1mh"
path="res://.godot/imported/Terrain (32x32).png-4f95ce99f3c57048b19232252a9fdf8e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Environment/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-4f95ce99f3c57048b19232252a9fdf8e.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.7 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dsv73ksok5b4"
path="res://.godot/imported/crate.png-ed89deb65fd736c2c62fd7e3b8676928.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Object/crate.png"
dest_files=["res://.godot/imported/crate.png-ed89deb65fd736c2c62fd7e3b8676928.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://csjeohonmkkov"
path="res://.godot/imported/Player Idle 48x48.png-43d8fdefecc09abb7b8a43ca7514cca3.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-43d8fdefecc09abb7b8a43ca7514cca3.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://4b3eimvxs4xa"
path="res://.godot/imported/player jump 48x48.png-197ede03251a4cd7c1d571acd2dc6d80.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-197ede03251a4cd7c1d571acd2dc6d80.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://7jk3tlc1nyw2"
path="res://.godot/imported/player run 48x48.png-3c23f749058e47947519f4e375cf2db5.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-3c23f749058e47947519f4e375cf2db5.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://br8ex2kfbjw0v"
path="res://.godot/imported/pixel_bullet.png-b20bc90037658b47ed24c62828bcb3fa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/pixel_bullet.png"
dest_files=["res://.godot/imported/pixel_bullet.png-b20bc90037658b47ed24c62828bcb3fa.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

@ -1,14 +1,22 @@
[gd_scene load_steps=3 format=3 uid="uid://djsdyfqvl85k1"]
[gd_scene load_steps=4 format=3 uid="uid://djsdyfqvl85k1"]
[ext_resource type="Script" path="res://Sripts/Bullet.gd" id="1_iqvku"]
[ext_resource type="Script" path="res://Sripts/bullet.gd" id="1_iqvku"]
[ext_resource type="Texture2D" uid="uid://br8ex2kfbjw0v" path="res://Assets/Graphics/pixel_bullet.png" id="2_pt151"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0nhk6"]
size = Vector2(20, 11)
size = Vector2(21, 8)
[node name="Area2D" type="Area2D"]
script = ExtResource("1_iqvku")
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(-6, -4)
rotation = -3.14159
scale = Vector2(0.156731, 0.156731)
texture = ExtResource("2_pt151")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_0nhk6")
debug_color = Color(0.345732, 0.414118, 0.250065, 0.42)

View File

@ -1,12 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://bq1tvv23y61by"]
[gd_scene load_steps=4 format=3 uid="uid://bq1tvv23y61by"]
[ext_resource type="Script" path="res://Sripts/crate.gd" id="1_4l5o6"]
[ext_resource type="Texture2D" uid="uid://dsv73ksok5b4" path="res://Assets/Graphics/Object/crate.png" id="2_5w0ot"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_amdo7"]
[node name="RigidBody2D" type="RigidBody2D"]
script = ExtResource("1_4l5o6")
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, 1)
scale = Vector2(0.0754018, 0.0754018)
texture = ExtResource("2_5w0ot")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_amdo7")

View File

@ -1,15 +1,81 @@
[gd_scene load_steps=6 format=3 uid="uid://bnrrbkgwh35jy"]
[gd_scene load_steps=10 format=4 uid="uid://bnrrbkgwh35jy"]
[ext_resource type="PackedScene" uid="uid://bq1tvv23y61by" path="res://Scenes/Crate.tscn" id="1_8ldta"]
[ext_resource type="Script" path="res://Sripts/scene_manager.gd" id="1_j03ar"]
[ext_resource type="Texture2D" uid="uid://b80n7lhw6e1mh" path="res://Assets/Graphics/Environment/Terrain (32x32).png" id="2_hfhl3"]
[ext_resource type="PackedScene" uid="uid://crvsom7i1waff" path="res://Scenes/Player.tscn" id="2_vxspj"]
[ext_resource type="PackedScene" uid="uid://cb1km20mpc3ag" path="res://Scenes/Trigger.tscn" id="3_sr8fi"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kvyqi"]
texture = ExtResource("2_hfhl3")
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_ge2ih"]
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_kvyqi")
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_flxcs"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6fyfv"]
[node name="World" type="Node2D"]
[node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("1_j03ar")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
position = Vector2(1, 0)
tile_map_data = PackedByteArray("AAABABQAAAABAAAAAAACABQAAAABAAAAAAADABQAAAABAAAAAAAEABQAAAABAAEAAAAFABQAAAABAAEAAAAGABQAAAABAAEAAAAHABQAAAABAAEAAAAIABQAAAABAAAAAAAJABQAAAABAAAAAAAKABQAAAABAAAAAAALABQAAAABAAAAAAAMABQAAAABAAAAAAANABQAAAABAAAAAAAOABQAAAABAAAAAAAPABQAAAABAAAAAAAQABQAAAABAAAAAAARABQAAAABAAAAAAASABQAAAABAAAAAAATABQAAAABAAAAAAAUABQAAAABAAAAAAAVABQAAAABAAAAAAAWABQAAAABAAAAAAAKABUAAAABAAEAAAALABUAAAABAAEAAAAMABUAAAABAAEAAAAXABQAAAABAAAAAAAYABQAAAABAAAAAAAZABQAAAABAAAAAAAaABQAAAABAAAAAAAbABQAAAABAAAAAAAcABQAAAABAAAAAAAdABQAAAABAAAAAAAeABQAAAABAAAAAAABABUAAAABAAEAAAACABUAAAABAAEAAAADABUAAAABAAEAAAAEABUAAAABAAEAAAAFABUAAAABAAEAAAAGABUAAAABAAEAAAAHABUAAAABAAEAAAAIABUAAAABAAEAAAAJABUAAAABAAEAAAANABUAAAABAAEAAAAOABUAAAABAAEAAAAPABUAAAABAAEAAAAQABUAAAABAAEAAAARABUAAAABAAEAAAASABUAAAABAAEAAAATABUAAAABAAEAAAAUABUAAAABAAEAAAAVABUAAAABAAEAAAAWABUAAAABAAEAAAAXABUAAAABAAEAAAAYABUAAAABAAEAAAAZABUAAAABAAEAAAAaABUAAAABAAEAAAAbABUAAAABAAEAAAAcABUAAAABAAEAAAAdABUAAAABAAEAAAAeABUAAAABAAEAAAABABYAAAABAAEAAAACABYAAAABAAEAAAADABYAAAABAAEAAAAEABYAAAABAAEAAAAFABYAAAABAAEAAAAGABYAAAABAAEAAAAHABYAAAABAAEAAAAIABYAAAABAAEAAAAJABYAAAABAAEAAAAKABYAAAABAAEAAAALABYAAAABAAEAAAAMABYAAAABAAEAAAANABYAAAABAAEAAAAOABYAAAABAAEAAAAPABYAAAABAAEAAAAQABYAAAABAAEAAAARABcAAAABAAEAAAASABcAAAABAAEAAAATABcAAAABAAEAAAAUABYAAAABAAEAAAAVABYAAAABAAEAAAAWABYAAAABAAEAAAAXABYAAAABAAEAAAAYABYAAAABAAEAAAATABYAAAABAAEAAAASABYAAAABAAEAAAARABYAAAABAAEAAAAZABYAAAABAAEAAAAaABYAAAABAAEAAAAbABYAAAABAAEAAAAcABYAAAABAAEAAAAdABYAAAABAAEAAAAeABYAAAABAAEAAAAfABYAAAABAAEAAAAgABYAAAABAAEAAAAhABYAAAABAAEAAAAiABYAAAABAAEAAAAUABcAAAABAAEAAAAQABcAAAABAAEAAAAPABcAAAABAAEAAAAOABcAAAABAAEAAAANABcAAAABAAEAAAAMABcAAAABAAEAAAALABcAAAABAAEAAAAKABcAAAABAAEAAAAJABcAAAABAAEAAAAIABcAAAABAAEAAAAHABcAAAABAAEAAAAGABcAAAABAAEAAAAFABcAAAABAAEAAAAEABcAAAABAAEAAAADABcAAAABAAEAAAACABcAAAABAAEAAAABABcAAAABAAEAAAAAABcAAAABAAEAAAD//xcAAAABAAEAAAAAABYAAAABAAEAAAD//xYAAAABAAEAAAD//xUAAAABAAEAAAAAABUAAAABAAEAAAD//xQAAAABAAAAAAAAABQAAAABAAAAAAAfABQAAAABAAAAAAAgABQAAAABAAAAAAAhABQAAAABAAAAAAAiABQAAAABAAAAAAAVABcAAAABAAEAAAAWABcAAAABAAEAAAAXABcAAAABAAEAAAAYABcAAAABAAEAAAAZABcAAAABAAEAAAAaABcAAAABAAEAAAAbABcAAAABAAEAAAAcABcAAAABAAEAAAAdABcAAAABAAEAAAAeABcAAAABAAEAAAAfABcAAAABAAEAAAAgABcAAAABAAEAAAAhABcAAAABAAEAAAAiABcAAAABAAEAAAAiABUAAAABAAEAAAAhABUAAAABAAEAAAAgABUAAAABAAEAAAAfABUAAAABAAEAAAALABEAAAABAAQAAAAKABEAAAABAAQAAAAMABEAAAACAAQAAAAJABEAAAAAAAQAAAAHABMAAAACAAAAAAAEABMAAAAAAAAAAAAFABMAAAABAAAAAAAGABMAAAABAAAAAAA=")
tile_set = SubResource("TileSet_ge2ih")
[node name="BottomWorld" type="StaticBody2D" parent="."]
position = Vector2(-1, 650)
metadata/_edit_group_ = true
@ -18,14 +84,16 @@ metadata/_edit_group_ = true
shape = SubResource("WorldBoundaryShape2D_flxcs")
[node name="platform" type="StaticBody2D" parent="."]
position = Vector2(554, 322)
position = Vector2(353, 560)
scale = Vector2(6.24941, -1.55682)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="platform"]
shape = SubResource("RectangleShape2D_6fyfv")
[node name="platform2" type="StaticBody2D" parent="."]
position = Vector2(478, 381)
position = Vector2(193, 627)
scale = Vector2(6.21275, 1.76679)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="platform2"]
@ -38,14 +106,22 @@ metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="platform3"]
shape = SubResource("RectangleShape2D_6fyfv")
[node name="CharacterBody2D" parent="." instance=ExtResource("2_vxspj")]
[node name="CharacterBody2D" parent="." groups=["Player"] instance=ExtResource("2_vxspj")]
position = Vector2(522, 600)
[node name="Camera2D" type="Camera2D" parent="CharacterBody2D"]
[node name="Area2D" parent="." instance=ExtResource("3_sr8fi")]
position = Vector2(683, 645)
[node name="RigidBody2D" parent="." groups=["Pushable"] instance=ExtResource("1_8ldta")]
position = Vector2(298, 550)
position = Vector2(204, 544)
[node name="RigidBody2D2" parent="." groups=["Pushable"] instance=ExtResource("1_8ldta")]
position = Vector2(297, 527)
[node name="RigidBody2D3" parent="." groups=["Pushable"] instance=ExtResource("1_8ldta")]
position = Vector2(298, 499)
[node name="BoxTrapTarget" type="Node2D" parent="."]
position = Vector2(683, 461)

View File

@ -1,12 +1,188 @@
[gd_scene load_steps=3 format=3 uid="uid://crvsom7i1waff"]
[gd_scene load_steps=28 format=3 uid="uid://crvsom7i1waff"]
[ext_resource type="Script" path="res://Sripts/player.gd" id="1_jdiv6"]
[ext_resource type="Texture2D" uid="uid://csjeohonmkkov" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_ow1rs"]
[ext_resource type="Texture2D" uid="uid://4b3eimvxs4xa" path="res://Assets/Graphics/Player/Jump/player jump 48x48.png" id="3_d7uya"]
[ext_resource type="Texture2D" uid="uid://7jk3tlc1nyw2" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_kgjol"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ogmew"]
atlas = ExtResource("2_ow1rs")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gket1"]
atlas = ExtResource("2_ow1rs")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gsema"]
atlas = ExtResource("2_ow1rs")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qpim6"]
atlas = ExtResource("2_ow1rs")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_w6eh5"]
atlas = ExtResource("2_ow1rs")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wftcm"]
atlas = ExtResource("2_ow1rs")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3qd2c"]
atlas = ExtResource("2_ow1rs")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_0ayb1"]
atlas = ExtResource("2_ow1rs")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vng5u"]
atlas = ExtResource("2_ow1rs")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_40r1e"]
atlas = ExtResource("2_ow1rs")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_83b8o"]
atlas = ExtResource("3_d7uya")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_snne0"]
atlas = ExtResource("3_d7uya")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_2am5l"]
atlas = ExtResource("3_d7uya")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_xvnqx"]
atlas = ExtResource("3_kgjol")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_80s61"]
atlas = ExtResource("3_kgjol")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wv0jk"]
atlas = ExtResource("3_kgjol")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_td60s"]
atlas = ExtResource("3_kgjol")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_6vtxt"]
atlas = ExtResource("3_kgjol")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_plerx"]
atlas = ExtResource("3_kgjol")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_rqf2p"]
atlas = ExtResource("3_kgjol")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_jyxx1"]
atlas = ExtResource("3_kgjol")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_f8fvt"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ogmew")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gket1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gsema")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qpim6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w6eh5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wftcm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3qd2c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0ayb1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vng5u")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_40r1e")
}],
"loop": true,
"name": &"Idle",
"speed": 15.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_83b8o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_snne0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2am5l")
}],
"loop": false,
"name": &"Jump",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_xvnqx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_80s61")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wv0jk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_td60s")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6vtxt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_plerx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rqf2p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jyxx1")
}],
"loop": true,
"name": &"Run",
"speed": 15.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_t5iiu"]
[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_jdiv6")
metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -6)
sprite_frames = SubResource("SpriteFrames_f8fvt")
animation = &"Jump"
autoplay = "Idle"
frame = 1
frame_progress = 1.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_t5iiu")
@ -19,7 +195,7 @@ target_position = Vector2(25, 0)
target_position = Vector2(-25, 0)
[node name="MarkerRight" type="Node2D" parent="."]
position = Vector2(14, -2)
position = Vector2(14, -6)
[node name="MarkerLeft" type="Node2D" parent="."]
position = Vector2(-14, -2)
position = Vector2(-14, -6)

View File

@ -1,10 +1,15 @@
extends Area2D
@onready var BulletSprite: Sprite2D = $Sprite2D
var speed := 700
signal hit(bullet, body)
func setSpeed(speedVal):
speed = speedVal
if speedVal < 0:
BulletSprite.flip_h = true
else:
BulletSprite.flip_h = false
func _physics_process(delta: float) -> void:
position += transform.x * speed * delta

View File

@ -13,6 +13,7 @@ var pushRightEnabled = false
@onready var left_ray: RayCast2D = $LeftRay
@onready var marker_right: Node2D = $MarkerRight
@onready var marker_left: Node2D = $MarkerLeft
@onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D
var pushTarget
@ -39,36 +40,41 @@ func _physics_process(delta: float) -> void:
pushRightEnabled = false
if Input.is_action_just_pressed("Shoot"):
print ("Shooting")
var mybullet = bullet.instantiate()
if faceLeft:
print("shoot left")
mybullet.setSpeed(-700)
#position bullet
mybullet.transform = marker_left.global_transform
#mybullet.setSpeed(-700)
#mybullet.transform = marker_left.global_transform
%SceneManager.placeBullet(-700, marker_left.global_transform)
else:
print("shoot right")
#position bullet
mybullet.transform = marker_right.global_transform
#add bullet
owner.add_child(mybullet)
#mybullet.transform = marker_right.global_transform
%SceneManager.placeBullet(700, marker_right.global_transform)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("ui_left", "ui_right")
if direction <0:
faceLeft = true
playerSprite.flip_h = true
if direction >0:
faceLeft = false
playerSprite.flip_h = false
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
if is_on_floor():
if direction == 0:
playerSprite.play("Idle")
else:
playerSprite.play("Run")
else:
playerSprite.play("Jump")
move_and_slide()
for i in get_slide_collision_count():
var c = get_slide_collision(i)

View File

@ -0,0 +1,48 @@
extends Node
var crate = preload("res://Scenes/Crate.tscn")
var bullet = preload("res://Scenes/Bullet.tscn")
var bulletPool:Array = []
# crate pool thing
var cratePool:Array = []
@onready var box_trap_target: Node2D = $"../BoxTrapTarget"
func _ready() -> void:
# pool crates
for obj in owner.get_children():
if obj.is_in_group("Pushable"):
cratePool.push_back(obj)
print("Total crate in play: "+str(cratePool.size() ) )
func boxTrap():
print("boxTrap active")
var myCrate = crateFactory()
myCrate.transform = box_trap_target.transform
owner.add_child(myCrate)
func bulletFactory():
#make/reuse bullets
var myBullet
print("Total bullets in play: "+str(bulletPool.size() ) )
if bulletPool.size() > 5:
myBullet = bulletPool.pop_front()
else:
myBullet = bullet.instantiate()
owner.add_child(myBullet)
return myBullet
func placeBullet(speed, markerpos):
print("make a bullet")
var myBullet = bulletFactory()
bulletPool.push_back(myBullet)
print("Total bullets in play: "+str(bulletPool.size() ) )
# set speed
myBullet.setSpeed(speed)
# set position of bullet
myBullet.transform = markerpos
# make bullet
func crateFactory():
var myCrate = crate.instantiate()
myCrate.add_to_group("Pushable")
return myCrate

View File

@ -14,6 +14,9 @@ func _process(delta: float) -> void:
func _on_body_entered(body: Node2D) -> void:
print("Zone Entered")
if body.is_in_group("Player"):
print("player enters trap")
%SceneManager.boxTrap()
func _on_body_exited(body: Node2D) -> void:

View File

@ -15,6 +15,20 @@ run/main_scene="res://Scenes/Game.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
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]
folder_colors={
"res://Assets/Graphics/": "teal"
}
[input]
Shove={