diff --git a/Car.gd b/Car.gd new file mode 100644 index 0000000..8771e7b --- /dev/null +++ b/Car.gd @@ -0,0 +1,55 @@ +extends KinematicBody2D + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +var moveSpeed : int = 180 +var vel = Vector2() +var facingDir = Vector2() +onready var rayCast = $RayCast2D +onready var anim = $AnimatedSprite + +func _ready(): + pass + +func _physics_process(delta): + handle_interactions() + handle_movements() + +func handle_interactions(): + if Input.is_action_just_pressed("ui_accept"): + for body in $Area2D.get_overlapping_areas(): + if body.has_method("show_dialogue"): + body.show_dialogue() + return + +func handle_movements(): + vel = Vector2(-1, 0) + + # inputs + if Input.is_action_pressed("move_up"): + vel.y = -1 + facingDir = Vector2(-1, -1) + if Input.is_action_pressed("move_down"): + vel.y = 1 + facingDir = Vector2(-1, 1) + if Input.is_action_pressed("move_left"): + vel.x = -1 + facingDir = Vector2(-1, 0) + + # move the player + move_and_slide(vel * moveSpeed, Vector2.ZERO) + manage_animations() + +func play_animation (anim_name): + if anim.animation != anim_name: + anim.play(anim_name) + +func manage_animations (): + if vel.x < 0: + play_animation("MoveLeft") + diff --git a/Scenes/Car.tscn b/Scenes/Car.tscn new file mode 100644 index 0000000..98649cc --- /dev/null +++ b/Scenes/Car.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://Car.gd" type="Script" id=1] +[ext_resource path="res://Sprites/alistair/car-full-1.png" type="Texture" id=2] +[ext_resource path="res://Sprites/alistair/car-full-2.png" type="Texture" id=3] +[ext_resource path="res://Sprites/alistair/car-full.png" type="Texture" id=4] +[ext_resource path="res://Sprites/alistair/car-full-3.png" type="Texture" id=5] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 4 ), ExtResource( 2 ), ExtResource( 3 ), ExtResource( 5 ) ], +"loop": true, +"name": "default", +"speed": 5.0 +} ] + +[sub_resource type="CapsuleShape2D" id=2] +radius = 26.0 +height = 236.0 + +[node name="Car" type="KinematicBody2D"] +script = ExtResource( 1 ) + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +position = Vector2( 0, -42 ) +frames = SubResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, 3 ) +rotation = 1.5708 +shape = SubResource( 2 ) diff --git a/Scenes/Player.tscn b/Scenes/Player.tscn index e6828ee..97fce9e 100644 --- a/Scenes/Player.tscn +++ b/Scenes/Player.tscn @@ -16,9 +16,9 @@ [sub_resource type="SpriteFrames" id=2] animations = [ { -"frames": [ ExtResource( 2 ), ExtResource( 6 ), ExtResource( 2 ), ExtResource( 7 ) ], +"frames": [ ExtResource( 3 ) ], "loop": true, -"name": "MoveDown", +"name": "IdleRight", "speed": 5.0 }, { "frames": [ ExtResource( 5 ), ExtResource( 14 ), ExtResource( 5 ), ExtResource( 15 ) ], @@ -36,9 +36,14 @@ animations = [ { "name": "MoveRight", "speed": 5.0 }, { -"frames": [ ExtResource( 3 ) ], +"frames": [ ExtResource( 2 ), ExtResource( 6 ), ExtResource( 2 ), ExtResource( 7 ) ], "loop": true, -"name": "IdleRight", +"name": "MoveDown", +"speed": 5.0 +}, { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"name": "IdleLeft", "speed": 5.0 }, { "frames": [ ExtResource( 2 ) ], @@ -50,11 +55,6 @@ animations = [ { "loop": true, "name": "IdleUp", "speed": 5.0 -}, { -"frames": [ ExtResource( 4 ) ], -"loop": true, -"name": "IdleLeft", -"speed": 5.0 } ] [sub_resource type="CapsuleShape2D" id=4] diff --git a/Scripts/Ch1S1.gd b/Scripts/Ch1S1.gd index 1524eab..2d58ca6 100644 --- a/Scripts/Ch1S1.gd +++ b/Scripts/Ch1S1.gd @@ -13,5 +13,5 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - player.position.y = clamp(player.position.y, 440, 500) + player.position.y = clamp(player.position.y, 480, 500) pass diff --git a/Sprites/alistair/car-1.png b/Sprites/alistair/car-1.png new file mode 100644 index 0000000..1cf2f8f Binary files /dev/null and b/Sprites/alistair/car-1.png differ diff --git a/Sprites/alistair/car-1.png.import b/Sprites/alistair/car-1.png.import new file mode 100644 index 0000000..5a66e09 --- /dev/null +++ b/Sprites/alistair/car-1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-1.png-bdff6bdf4ff690773a4a414ee2cac7ff.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-1.png" +dest_files=[ "res://.import/car-1.png-bdff6bdf4ff690773a4a414ee2cac7ff.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-2.png b/Sprites/alistair/car-2.png new file mode 100644 index 0000000..bf46106 Binary files /dev/null and b/Sprites/alistair/car-2.png differ diff --git a/Sprites/alistair/car-2.png.import b/Sprites/alistair/car-2.png.import new file mode 100644 index 0000000..6201cdc --- /dev/null +++ b/Sprites/alistair/car-2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-2.png-f14ebdd25b94d9c25824d9a37faa4cb0.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-2.png" +dest_files=[ "res://.import/car-2.png-f14ebdd25b94d9c25824d9a37faa4cb0.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-3.png b/Sprites/alistair/car-3.png new file mode 100644 index 0000000..e834fdc Binary files /dev/null and b/Sprites/alistair/car-3.png differ diff --git a/Sprites/alistair/car-3.png.import b/Sprites/alistair/car-3.png.import new file mode 100644 index 0000000..8d96ccd --- /dev/null +++ b/Sprites/alistair/car-3.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-3.png-9481e6a0d35cc134c8d5b801cecbb9b8.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-3.png" +dest_files=[ "res://.import/car-3.png-9481e6a0d35cc134c8d5b801cecbb9b8.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-full-1.png b/Sprites/alistair/car-full-1.png new file mode 100644 index 0000000..751708d Binary files /dev/null and b/Sprites/alistair/car-full-1.png differ diff --git a/Sprites/alistair/car-full-1.png.import b/Sprites/alistair/car-full-1.png.import new file mode 100644 index 0000000..383837a --- /dev/null +++ b/Sprites/alistair/car-full-1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-full-1.png-cabcdf79796cb99f9547cd171458def1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-full-1.png" +dest_files=[ "res://.import/car-full-1.png-cabcdf79796cb99f9547cd171458def1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-full-2.png b/Sprites/alistair/car-full-2.png new file mode 100644 index 0000000..5f4b1b4 Binary files /dev/null and b/Sprites/alistair/car-full-2.png differ diff --git a/Sprites/alistair/car-full-2.png.import b/Sprites/alistair/car-full-2.png.import new file mode 100644 index 0000000..1d27911 --- /dev/null +++ b/Sprites/alistair/car-full-2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-full-2.png-31f338b49f9a83f45b974953c3daa168.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-full-2.png" +dest_files=[ "res://.import/car-full-2.png-31f338b49f9a83f45b974953c3daa168.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-full-3.png b/Sprites/alistair/car-full-3.png new file mode 100644 index 0000000..6eea821 Binary files /dev/null and b/Sprites/alistair/car-full-3.png differ diff --git a/Sprites/alistair/car-full-3.png.import b/Sprites/alistair/car-full-3.png.import new file mode 100644 index 0000000..0b899c6 --- /dev/null +++ b/Sprites/alistair/car-full-3.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-full-3.png-aacd25ee16102299047a8b4febbcfdb4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-full-3.png" +dest_files=[ "res://.import/car-full-3.png-aacd25ee16102299047a8b4febbcfdb4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car-full.png b/Sprites/alistair/car-full.png new file mode 100644 index 0000000..aa7bc2f Binary files /dev/null and b/Sprites/alistair/car-full.png differ diff --git a/Sprites/alistair/car-full.png.import b/Sprites/alistair/car-full.png.import new file mode 100644 index 0000000..1046804 --- /dev/null +++ b/Sprites/alistair/car-full.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car-full.png-2c1e401ef60c637738e9b43291418fbc.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car-full.png" +dest_files=[ "res://.import/car-full.png-2c1e401ef60c637738e9b43291418fbc.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/car.png b/Sprites/alistair/car.png new file mode 100644 index 0000000..bfe8109 Binary files /dev/null and b/Sprites/alistair/car.png differ diff --git a/Sprites/alistair/car.png.import b/Sprites/alistair/car.png.import new file mode 100644 index 0000000..9044fed --- /dev/null +++ b/Sprites/alistair/car.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/car.png-9f335fa2876abcec914947ec4f8f3902.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/car.png" +dest_files=[ "res://.import/car.png-9f335fa2876abcec914947ec4f8f3902.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/alistair/left.png b/Sprites/alistair/left.png new file mode 100644 index 0000000..1aa43c7 Binary files /dev/null and b/Sprites/alistair/left.png differ diff --git a/Sprites/alistair/left.png.import b/Sprites/alistair/left.png.import new file mode 100644 index 0000000..da62575 --- /dev/null +++ b/Sprites/alistair/left.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/left.png-453be290be6ab754f1df243900cc4d6a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/alistair/left.png" +dest_files=[ "res://.import/left.png-453be290be6ab754f1df243900cc4d6a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Sprites/joe/left.png b/Sprites/joe/left.png new file mode 100644 index 0000000..a7c345c Binary files /dev/null and b/Sprites/joe/left.png differ diff --git a/Sprites/joe/left.png.import b/Sprites/joe/left.png.import new file mode 100644 index 0000000..1af35bc --- /dev/null +++ b/Sprites/joe/left.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/left.png-0ab7d68e67a10834ebf4b11b8ec91c9e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/joe/left.png" +dest_files=[ "res://.import/left.png-0ab7d68e67a10834ebf4b11b8ec91c9e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Story/Ch1S1.tscn b/Story/Ch1S1.tscn index e667991..1557c13 100644 --- a/Story/Ch1S1.tscn +++ b/Story/Ch1S1.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=6 format=2] [ext_resource path="res://Resources/woods.tres" type="TileSet" id=1] -[ext_resource path="res://Scenes/Player.tscn" type="PackedScene" id=2] +[ext_resource path="res://Scenes/Car.tscn" type="PackedScene" id=2] [ext_resource path="res://Scripts/ScrollCamera.gd" type="Script" id=3] [ext_resource path="res://Scripts/Ch1S1.gd" type="Script" id=4] [ext_resource path="res://Music/Main Menu-Unmastered.mp3" type="AudioStream" id=5] @@ -143,9 +143,6 @@ cell_custom_transform = Transform2D( 30, 0, 0, 0, 0, 0 ) format = 1 tile_data = PoolIntArray( 65536, 7, 0, 65538, 15, 0, 65540, 15, 0, 65542, 15, 0, 65544, 15, 0, 65546, 15, 0, 65548, 15, 0, 65550, 15, 0, 65552, 15, 0, 65554, 15, 0, 65556, 15, 0, 65558, 15, 0, 65560, 15, 0, 65562, 15, 0, 65564, 15, 0, 65566, 15, 0, 65568, 15, 0, 65570, 15, 0, 65572, 15, 0, 65574, 15, 0, 65576, 15, 0, 65578, 15, 0, 65580, 15, 0, 65582, 15, 0, 65584, 7, 0, 65586, 15, 0, 65588, 15, 0, 65590, 15, 0, 65592, 15, 0, 65594, 15, 0, 65596, 15, 0, 65598, 15, 0, 65600, 15, 0, 65602, 15, 0, 65604, 15, 0, 65606, 15, 0, 65608, 15, 0, 65610, 15, 0, 65612, 15, 0, 65614, 15, 0, 65616, 15, 0, 65618, 15, 0, 65620, 15, 0, 65622, 15, 0, 65624, 15, 0, 65626, 15, 0, 65628, 15, 0, 65630, 15, 0, 393218, 21, 0, 393230, 20, 0, 655394, 536870928, 0, 655424, 16, 0, 655430, 536870937, 0, 720896, 16, 0, 720937, 25, 0 ) -[node name="Player" parent="." instance=ExtResource( 2 )] -position = Vector2( 480, 480 ) - [node name="Foreground" type="ParallaxBackground" parent="."] layer = 1 @@ -175,3 +172,6 @@ tile_data = PoolIntArray( 24, 23, 0, 458752, 12, 0, 458756, 12, 0, 458760, 12, 0 [node name="Shrubs" type="TileMap" parent="Foreground/Close"] tile_set = ExtResource( 1 ) format = 1 + +[node name="Player" parent="." instance=ExtResource( 2 )] +position = Vector2( 1090, 458 )