sunday work

This commit is contained in:
bicubico 2024-07-07 18:03:45 -04:00
parent 2f31d5ddf7
commit d0525b3489
5 changed files with 369 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

After

Width:  |  Height:  |  Size: 366 KiB

View file

@ -11,6 +11,7 @@ config_version=5
[application] [application]
config/name="Citytic" config/name="Citytic"
run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.2", "Mobile") config/features=PackedStringArray("4.2", "Mobile")
config/icon="res://icon.svg" config/icon="res://icon.svg"

View file

@ -1,23 +1,100 @@
[gd_scene load_steps=4 format=3 uid="uid://b584vtyouaijk"] [gd_scene load_steps=14 format=3 uid="uid://b584vtyouaijk"]
[ext_resource type="Script" path="res://scripts/car.gd" id="1_8tph7"]
[ext_resource type="Texture2D" uid="uid://oqahvvfnkpnm" path="res://assets/cars/car01/sprites.png" id="1_d6ty7"] [ext_resource type="Texture2D" uid="uid://oqahvvfnkpnm" path="res://assets/cars/car01/sprites.png" id="1_d6ty7"]
[sub_resource type="AtlasTexture" id="AtlasTexture_bvf5d"] [sub_resource type="AtlasTexture" id="AtlasTexture_af1ee"]
atlas = ExtResource("1_d6ty7") atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1335, 512, 267) region = Rect2(0, 1345, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_2rnss"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1345, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_73yi3"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 807, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_mqdpn"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1883, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_g06uk"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1345, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_g1j3b"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 538, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_nc0tg"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1614, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_wg6ew"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 0, 477, 269)
[sub_resource type="AtlasTexture" id="AtlasTexture_vgy37"]
atlas = ExtResource("1_d6ty7")
region = Rect2(0, 1076, 477, 269)
[sub_resource type="SpriteFrames" id="SpriteFrames_xun5y"] [sub_resource type="SpriteFrames" id="SpriteFrames_xun5y"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_bvf5d") "texture": SubResource("AtlasTexture_af1ee")
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"running",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_2rnss")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_73yi3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mqdpn")
}],
"loop": true,
"name": &"stop",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_g06uk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g1j3b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nc0tg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wg6ew")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vgy37")
}],
"loop": true,
"name": &"turn_left",
"speed": 5.0 "speed": 5.0
}] }]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wkntf"]
size = Vector2(265, 266)
[node name="CharacterBody2D" type="CharacterBody2D"] [node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_8tph7")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -134)
sprite_frames = SubResource("SpriteFrames_xun5y") sprite_frames = SubResource("SpriteFrames_xun5y")
animation = &"running"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-40.5, -135)
shape = SubResource("RectangleShape2D_wkntf")

View file

@ -1,3 +1,260 @@
[gd_scene format=3 uid="uid://bwajltnrfw3ed"] [gd_scene load_steps=7 format=3 uid="uid://bwajltnrfw3ed"]
[ext_resource type="PackedScene" uid="uid://b584vtyouaijk" path="res://scenes/car.tscn" id="1_v32qj"]
[ext_resource type="Texture2D" uid="uid://b4stgxi35r223" path="res://assets/city/Medium/_Spritesheet_Tileset.png" id="2_dvrcb"]
[ext_resource type="Texture2D" uid="uid://dlss5cu23db1l" path="res://assets/city/Medium/_Spritesheet_Objects.png" id="3_2726a"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4whsd"]
texture = ExtResource("2_dvrcb")
texture_region_size = Vector2i(128, 128)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
8:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
8:1/0 = 0
0:2/0 = 0
1:2/0 = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
0:3/0 = 0
1:3/0 = 0
2:3/0 = 0
3:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
8:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
8:4/0 = 0
0:5/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
8:5/0 = 0
0:6/0 = 0
1:6/0 = 0
2:6/0 = 0
3:6/0 = 0
4:6/0 = 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0
5:6/0 = 0
6:6/0 = 0
7:6/0 = 0
8:6/0 = 0
9:6/0 = 0
10:6/0 = 0
11:6/0 = 0
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
8:7/0 = 0
9:7/0 = 0
10:7/0 = 0
11:7/0 = 0
12:7/0 = 0
0:8/0 = 0
1:8/0 = 0
2:8/0 = 0
3:8/0 = 0
4:8/0 = 0
5:8/0 = 0
6:8/0 = 0
7:8/0 = 0
8:8/0 = 0
9:8/0 = 0
10:8/0 = 0
11:8/0 = 0
0:9/0 = 0
1:9/0 = 0
2:9/0 = 0
3:9/0 = 0
4:9/0 = 0
5:9/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
0:10/0 = 0
1:10/0 = 0
2:10/0 = 0
3:10/0 = 0
4:10/0 = 0
5:10/0 = 0
6:10/0 = 0
7:10/0 = 0
9:10/0 = 0
10:10/0 = 0
0:11/0 = 0
1:11/0 = 0
2:11/0 = 0
3:11/0 = 0
12:8/size_in_atlas = Vector2i(3, 3)
12:8/0 = 0
13:11/0 = 0
12:4/size_in_atlas = Vector2i(3, 3)
12:4/0 = 0
13:7/0 = 0
10:3/size_in_atlas = Vector2i(2, 2)
10:3/0 = 0
10:5/0 = 0
10:0/size_in_atlas = Vector2i(1, 3)
10:0/0 = 0
11:0/size_in_atlas = Vector2i(1, 2)
11:0/0 = 0
12:1/0 = 0
12:0/0 = 0
13:1/0 = 0
13:0/0 = 0
13:2/0 = 0
12:2/0 = 0
[sub_resource type="TileSet" id="TileSet_mt0qw"]
tile_size = Vector2i(128, 128)
sources/0 = SubResource("TileSetAtlasSource_4whsd")
sources/1 = SubResource("TileSetAtlasSource_we4wa")
[node name="game" type="Node2D"] [node name="game" type="Node2D"]
[node name="CharacterBody2D" parent="." instance=ExtResource("1_v32qj")]
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(-37, -110)
zoom = Vector2(0.5, 0.5)
[node name="TileMap" type="TileMap" parent="."]
position = Vector2(-14, 0)
tile_set = SubResource("TileSet_mt0qw")
format = 2

28
scripts/car.gd Normal file
View file

@ -0,0 +1,28 @@
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# 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:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()