mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-11 20:06:14 +01:00
delete gitignore files
This commit is contained in:
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
# Dummy HTML5 export presets file for continuous integration
|
||||
!.github/dist/export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
# System/tool-specific ignores
|
||||
.directory
|
||||
.DS_Store
|
||||
*~
|
||||
26
Backround.gd
Normal file
26
Backround.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
|
||||
|
||||
const pre_background_straight = preload("res://background_straight.tscn")
|
||||
const pre_background_left = preload("res://Backround.gd")
|
||||
const pre_background_right = preload("res://Backround.gd")
|
||||
|
||||
var background_straight
|
||||
var background_left
|
||||
var background_right
|
||||
|
||||
var level
|
||||
|
||||
|
||||
func _ready():
|
||||
level = get_node("game")
|
||||
background_straight = pre_background_straight.instance()
|
||||
background_left = pre_background_left.instance()
|
||||
background_right = pre_background_right.instance()
|
||||
add_straight()
|
||||
|
||||
|
||||
|
||||
func add_straight():
|
||||
var single_straight = background_straight.get_child("straight").dublicate()
|
||||
level.add_child(single_straight)
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Nathan Hoad
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
Module.tscn
Normal file
3
Module.tscn
Normal file
@@ -0,0 +1,3 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Modules/Module.gd" id="1_42v8k"]
|
||||
28
Nodes/Player.tscn
Normal file
28
Nodes/Player.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://vwjd5od63jgh"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Player.gd" id="1_dta8q"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy6x8d3xe8lux" path="res://icon.svg" id="2_yjfj7"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p76ml"]
|
||||
radius = 0.500599
|
||||
height = 1.99403
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ndwdl"]
|
||||
radius = 0.567567
|
||||
|
||||
[node name="CharacterBody3D" type="CharacterBody3D"]
|
||||
script = ExtResource("1_dta8q")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
visible = false
|
||||
shape = SubResource("CapsuleShape3D_p76ml")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 2, 0)
|
||||
texture = ExtResource("2_yjfj7")
|
||||
|
||||
[node name="HitBox" type="Area3D" parent="."]
|
||||
collision_mask = 5
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="HitBox"]
|
||||
shape = SubResource("CapsuleShape3D_ndwdl")
|
||||
73
Nodes/StartNode.tscn
Normal file
73
Nodes/StartNode.tscn
Normal file
@@ -0,0 +1,73 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bqe8ucbruto1j"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Logic/StraightMapNode.gd" id="1_a5pbl"]
|
||||
[ext_resource type="PackedScene" uid="uid://bup2ps8l2ifj8" path="res://Nodes/StraightMapNode.tscn" id="2_wj4hp"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3ynfb5ky5p8g" path="res://Nodes/TurnMapNode.tscn" id="3_xy8vi"]
|
||||
|
||||
[node name="StartNode" type="Node" node_paths=PackedStringArray("next")]
|
||||
script = ExtResource("1_a5pbl")
|
||||
next = NodePath("StraightMapNode")
|
||||
|
||||
[node name="StraightMapNode" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode2")
|
||||
|
||||
[node name="StraightMapNode2" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../TurnMapNode")
|
||||
|
||||
[node name="TurnMapNode" parent="." node_paths=PackedStringArray("turn_node", "next") instance=ExtResource("3_xy8vi")]
|
||||
turn_node = NodePath("StraightMapNode")
|
||||
next = NodePath("../StraightMapNode3")
|
||||
|
||||
[node name="StraightMapNode" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode2")
|
||||
|
||||
[node name="StraightMapNode2" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode3")
|
||||
|
||||
[node name="StraightMapNode3" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode4")
|
||||
|
||||
[node name="StraightMapNode4" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode5")
|
||||
|
||||
[node name="StraightMapNode5" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode6")
|
||||
|
||||
[node name="StraightMapNode6" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode7")
|
||||
|
||||
[node name="StraightMapNode7" parent="TurnMapNode" node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../../StraightMapNode11")
|
||||
|
||||
[node name="StraightMapNode3" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode4")
|
||||
|
||||
[node name="StraightMapNode4" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode5")
|
||||
|
||||
[node name="StraightMapNode5" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode6")
|
||||
|
||||
[node name="StraightMapNode6" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode7")
|
||||
|
||||
[node name="StraightMapNode7" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode8")
|
||||
|
||||
[node name="StraightMapNode8" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode9")
|
||||
|
||||
[node name="StraightMapNode9" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode10")
|
||||
|
||||
[node name="StraightMapNode10" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode11")
|
||||
|
||||
[node name="StraightMapNode11" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode12")
|
||||
|
||||
[node name="StraightMapNode12" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("../StraightMapNode13")
|
||||
|
||||
[node name="StraightMapNode13" parent="." node_paths=PackedStringArray("next") instance=ExtResource("2_wj4hp")]
|
||||
next = NodePath("..")
|
||||
6
Nodes/StraightMapNode.tscn
Normal file
6
Nodes/StraightMapNode.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bup2ps8l2ifj8"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Logic/StraightMapNode.gd" id="1_1ejkw"]
|
||||
|
||||
[node name="StraightMapNode" type="Node"]
|
||||
script = ExtResource("1_1ejkw")
|
||||
6
Nodes/TurnMapNode.tscn
Normal file
6
Nodes/TurnMapNode.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c3ynfb5ky5p8g"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Logic/TurnMapNode.gd" id="1_wbnsc"]
|
||||
|
||||
[node name="TurnMapNode" type="Node"]
|
||||
script = ExtResource("1_wbnsc")
|
||||
6
Nodes/cannon.tscn
Normal file
6
Nodes/cannon.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://byo1m0n20yl45"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Modules/Cannon.gd" id="1_vdn0s"]
|
||||
|
||||
[node name="Cannon" type="Node"]
|
||||
script = ExtResource("1_vdn0s")
|
||||
64
Nodes/game.tscn
Normal file
64
Nodes/game.tscn
Normal file
@@ -0,0 +1,64 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://n7w0ff7u25yc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqe8ucbruto1j" path="res://Nodes/StartNode.tscn" id="2_61aog"]
|
||||
[ext_resource type="PackedScene" uid="uid://byo1m0n20yl45" path="res://Nodes/cannon.tscn" id="2_vrf6k"]
|
||||
[ext_resource type="Script" path="res://scripts/Train.gd" id="2_xl0he"]
|
||||
[ext_resource type="PackedScene" uid="uid://vwjd5od63jgh" path="res://Nodes/Player.tscn" id="4_1ipcp"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_ognqx"]
|
||||
size = Vector3(13, 1, 25)
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_p3d4e"]
|
||||
data = PackedVector3Array(-6.5, 0.5, 12.5, 6.5, 0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, -12.5, 6.5, -0.5, -12.5, -6.5, 0.5, -12.5, -6.5, -0.5, -12.5, 6.5, -0.5, -12.5, 6.5, 0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, -12.5, 6.5, -0.5, 12.5, -6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, 0.5, 12.5, -6.5, 0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, 0.5, -12.5, 6.5, 0.5, -12.5, -6.5, -0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, -0.5, 12.5, 6.5, -0.5, -12.5, -6.5, -0.5, -12.5)
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_l76gd"]
|
||||
data = PackedVector3Array(-6.5, 0.5, 12.5, 6.5, 0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, -12.5, 6.5, -0.5, -12.5, -6.5, 0.5, -12.5, -6.5, -0.5, -12.5, 6.5, -0.5, -12.5, 6.5, 0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, -12.5, 6.5, -0.5, 12.5, -6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, 0.5, 12.5, -6.5, 0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, 0.5, -12.5, 6.5, 0.5, -12.5, -6.5, -0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, -0.5, 12.5, 6.5, -0.5, -12.5, -6.5, -0.5, -12.5)
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
script = ExtResource("1_iox18")
|
||||
|
||||
[node name="StartNode" parent="." instance=ExtResource("2_61aog")]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 20, 0)
|
||||
|
||||
[node name="Player1" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -8, 0, 8)
|
||||
script = ExtResource("2_xl0he")
|
||||
|
||||
[node name="Cannon" parent="Player1" instance=ExtResource("2_vrf6k")]
|
||||
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="Player1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -8)
|
||||
mesh = SubResource("BoxMesh_ognqx")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Player1/MeshInstance3D2"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player1/MeshInstance3D2/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_p3d4e")
|
||||
|
||||
[node name="CharacterBody3D" parent="Player1" instance=ExtResource("4_1ipcp")]
|
||||
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, -1.18815, 1, -11.064)
|
||||
|
||||
[node name="Cannon2" parent="Player1" instance=ExtResource("2_vrf6k")]
|
||||
|
||||
[node name="Player2" type="Node3D" parent="."]
|
||||
transform = Transform3D(-0.0154456, -6.75145e-10, -0.999879, -5.21344e-12, 1, -6.75146e-10, 0.999879, -5.2134e-12, -0.0154456, -8, 0, -32)
|
||||
script = ExtResource("2_xl0he")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Player2"]
|
||||
transform = Transform3D(-0.0154456, -5.21524e-12, 0.999881, -6.75146e-10, 1, -5.21521e-12, -0.999881, -6.75146e-10, -0.0154456, 31.7182, -1.23195e-08, -18.4921)
|
||||
mesh = SubResource("BoxMesh_ognqx")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Player2/MeshInstance3D"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player2/MeshInstance3D/StaticBody3D"]
|
||||
transform = Transform3D(1, 8.23952e-25, 0, -1.6479e-25, 1, 0, 0, -1.65436e-24, 1, 0, 0, 0)
|
||||
shape = SubResource("ConcavePolygonShape3D_l76gd")
|
||||
|
||||
[node name="CharacterBody3D" parent="Player2" instance=ExtResource("4_1ipcp")]
|
||||
transform = Transform3D(-0.0154457, -5.21527e-12, 0.999882, -6.75147e-10, 1, -5.21524e-12, -0.999882, -6.75146e-10, -0.0154457, 31.3762, 1.5, -17.7157)
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.258819, 0.965926, 0, -0.965926, 0.258819, 0, 0, 0)
|
||||
7
Storage.tscn
Normal file
7
Storage.tscn
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cet80w4yr8rse"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Modules/Storage.gd" id="1_guwoh"]
|
||||
|
||||
[node name="Storage" type="Node"]
|
||||
script = ExtResource("1_guwoh")
|
||||
currentType = 0
|
||||
6
background.tscn
Normal file
6
background.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://27eaxr1cxhjl"]
|
||||
|
||||
[ext_resource type="Script" path="res://Backround.gd" id="1_hqtcb"]
|
||||
|
||||
[node name="Background" type="Node"]
|
||||
script = ExtResource("1_hqtcb")
|
||||
8
background_straight.tscn
Normal file
8
background_straight.tscn
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cgnegi0q52i3n"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cy6x8d3xe8lux" path="res://icon.svg" id="1_a2wr2"]
|
||||
|
||||
[node name="Background_straight" type="Node"]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_a2wr2")
|
||||
1
icon.svg
Normal file
1
icon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><g transform="translate(32 32)"><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99z" fill="#363d52"/><path d="m-16-32c-8.86 0-16 7.13-16 15.99v95.98c0 8.86 7.13 15.99 16 15.99h96c8.86 0 16-7.13 16-15.99v-95.98c0-8.85-7.14-15.99-16-15.99zm0 4h96c6.64 0 12 5.35 12 11.99v95.98c0 6.64-5.35 11.99-12 11.99h-96c-6.64 0-12-5.35-12-11.99v-95.98c0-6.64 5.36-11.99 12-11.99z" fill-opacity=".4"/></g><g stroke-width="9.92746" transform="matrix(.10073078 0 0 .10073078 12.425923 2.256365)"><path d="m0 0s-.325 1.994-.515 1.976l-36.182-3.491c-2.879-.278-5.115-2.574-5.317-5.459l-.994-14.247-27.992-1.997-1.904 12.912c-.424 2.872-2.932 5.037-5.835 5.037h-38.188c-2.902 0-5.41-2.165-5.834-5.037l-1.905-12.912-27.992 1.997-.994 14.247c-.202 2.886-2.438 5.182-5.317 5.46l-36.2 3.49c-.187.018-.324-1.978-.511-1.978l-.049-7.83 30.658-4.944 1.004-14.374c.203-2.91 2.551-5.263 5.463-5.472l38.551-2.75c.146-.01.29-.016.434-.016 2.897 0 5.401 2.166 5.825 5.038l1.959 13.286h28.005l1.959-13.286c.423-2.871 2.93-5.037 5.831-5.037.142 0 .284.005.423.015l38.556 2.75c2.911.209 5.26 2.562 5.463 5.472l1.003 14.374 30.645 4.966z" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 919.24059 771.67186)"/><path d="m0 0v-47.514-6.035-5.492c.108-.001.216-.005.323-.015l36.196-3.49c1.896-.183 3.382-1.709 3.514-3.609l1.116-15.978 31.574-2.253 2.175 14.747c.282 1.912 1.922 3.329 3.856 3.329h38.188c1.933 0 3.573-1.417 3.855-3.329l2.175-14.747 31.575 2.253 1.115 15.978c.133 1.9 1.618 3.425 3.514 3.609l36.182 3.49c.107.01.214.014.322.015v4.711l.015.005v54.325c5.09692 6.4164715 9.92323 13.494208 13.621 19.449-5.651 9.62-12.575 18.217-19.976 26.182-6.864-3.455-13.531-7.369-19.828-11.534-3.151 3.132-6.7 5.694-10.186 8.372-3.425 2.751-7.285 4.768-10.946 7.118 1.09 8.117 1.629 16.108 1.846 24.448-9.446 4.754-19.519 7.906-29.708 10.17-4.068-6.837-7.788-14.241-11.028-21.479-3.842.642-7.702.88-11.567.926v.006c-.027 0-.052-.006-.075-.006-.024 0-.049.006-.073.006v-.006c-3.872-.046-7.729-.284-11.572-.926-3.238 7.238-6.956 14.642-11.03 21.479-10.184-2.264-20.258-5.416-29.703-10.17.216-8.34.755-16.331 1.848-24.448-3.668-2.35-7.523-4.367-10.949-7.118-3.481-2.678-7.036-5.24-10.188-8.372-6.297 4.165-12.962 8.079-19.828 11.534-7.401-7.965-14.321-16.562-19.974-26.182 4.4426579-6.973692 9.2079702-13.9828876 13.621-19.449z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 104.69892 525.90697)"/><path d="m0 0-1.121-16.063c-.135-1.936-1.675-3.477-3.611-3.616l-38.555-2.751c-.094-.007-.188-.01-.281-.01-1.916 0-3.569 1.406-3.852 3.33l-2.211 14.994h-31.459l-2.211-14.994c-.297-2.018-2.101-3.469-4.133-3.32l-38.555 2.751c-1.936.139-3.476 1.68-3.611 3.616l-1.121 16.063-32.547 3.138c.015-3.498.06-7.33.06-8.093 0-34.374 43.605-50.896 97.781-51.086h.066.067c54.176.19 97.766 16.712 97.766 51.086 0 .777.047 4.593.063 8.093z" fill="#478cbf" transform="matrix(4.162611 0 0 -4.162611 784.07144 817.24284)"/><path d="m0 0c0-12.052-9.765-21.815-21.813-21.815-12.042 0-21.81 9.763-21.81 21.815 0 12.044 9.768 21.802 21.81 21.802 12.048 0 21.813-9.758 21.813-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 389.21484 625.67104)"/><path d="m0 0c0-7.994-6.479-14.473-14.479-14.473-7.996 0-14.479 6.479-14.479 14.473s6.483 14.479 14.479 14.479c8 0 14.479-6.485 14.479-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 367.36686 631.05679)"/><path d="m0 0c-3.878 0-7.021 2.858-7.021 6.381v20.081c0 3.52 3.143 6.381 7.021 6.381s7.028-2.861 7.028-6.381v-20.081c0-3.523-3.15-6.381-7.028-6.381" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 511.99336 724.73954)"/><path d="m0 0c0-12.052 9.765-21.815 21.815-21.815 12.041 0 21.808 9.763 21.808 21.815 0 12.044-9.767 21.802-21.808 21.802-12.05 0-21.815-9.758-21.815-21.802" fill="#fff" transform="matrix(4.162611 0 0 -4.162611 634.78706 625.67104)"/><path d="m0 0c0-7.994 6.477-14.473 14.471-14.473 8.002 0 14.479 6.479 14.479 14.473s-6.477 14.479-14.479 14.479c-7.994 0-14.471-6.485-14.471-14.479" fill="#414042" transform="matrix(4.162611 0 0 -4.162611 656.64056 631.05679)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 4.1 KiB |
39
icon.svg.import
Normal file
39
icon.svg.import
Normal file
@@ -0,0 +1,39 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cy6x8d3xe8lux"
|
||||
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc", "etc2"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex", "res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
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=0
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
26
menu/MainMenu.gd
Normal file
26
menu/MainMenu.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$VBoxContainer/Start.grab_focus() # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
|
||||
func _on_start_pressed():
|
||||
get_tree().change_scene_to_file("res://Nodes/game.tscn")
|
||||
# Replace with function body.
|
||||
|
||||
|
||||
func _on_tutorial_pressed():
|
||||
get_tree().change_scene_to_file("res://Nodes/game.tscn") # Replace with function body.
|
||||
|
||||
|
||||
func _on_quit_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
17
menu/VBoxContainer.gd
Normal file
17
menu/VBoxContainer.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends VBoxContainer
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_up_pressed():
|
||||
pass
|
||||
#InputHelper.set_action_key(action: String, key: String, swap_if_taken: bool = true) -> void
|
||||
#Replace with function body.
|
||||
21
menu/VolSlider.gd
Normal file
21
menu/VolSlider.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends HSlider
|
||||
|
||||
|
||||
var master_bus = AudioServer.get_bus_index("Master")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_value_changed(value):
|
||||
AudioServer.set_bus_volume_db(master_bus, value)
|
||||
if value == -30:
|
||||
AudioServer.set_bus_mute(master_bus, true)
|
||||
else:
|
||||
AudioServer.set_bus_mute(master_bus,false) # Replace with function body.
|
||||
20
menu/VolumeSlider.gd
Normal file
20
menu/VolumeSlider.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends HSlider
|
||||
|
||||
var master_bus = AudioServer.get_bus_index("Master")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_value_changed(value):
|
||||
AudioServer.set_bus_volume_db(master_bus, value)
|
||||
if value == -30:
|
||||
AudioServer.set_bus_mute(master_bus, true)
|
||||
else:
|
||||
AudioServer.set_bus_mute(master_bus,false) # Replace with function body.
|
||||
36
menu/credits_screen.tscn
Normal file
36
menu/credits_screen.tscn
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_scene format=3 uid="uid://c301ttbip7xm4"]
|
||||
|
||||
[node name="CreditsScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
color = Color(0.0784314, 0.243137, 0.552941, 1)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Lukas
|
||||
Jonas
|
||||
Arthur
|
||||
Lena
|
||||
Albion
|
||||
..."
|
||||
66
menu/main_menu.tscn
Normal file
66
menu/main_menu.tscn
Normal file
@@ -0,0 +1,66 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bsmsdlf5jiukx"]
|
||||
|
||||
[ext_resource type="Script" path="res://menu/MainMenu.gd" id="1_hyw8p"]
|
||||
[ext_resource type="Script" path="res://menu/VolSlider.gd" id="2_h85ei"]
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_hyw8p")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.513726, 0.403922, 0.27451, 1)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -28.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 28.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Start" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Start
|
||||
"
|
||||
|
||||
[node name="Tutorial" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Tutorial
|
||||
"
|
||||
|
||||
[node name="Settings" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Volume:"
|
||||
|
||||
[node name="VolSlider" type="HSlider" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
min_value = -30.0
|
||||
max_value = 0.0
|
||||
script = ExtResource("2_h85ei")
|
||||
|
||||
[node name="Quit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Quit"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Tutorial" to="." method="_on_tutorial_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Settings" to="." method="_on_settings_pressed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/VolSlider" to="VBoxContainer/VolSlider" method="_on_value_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Quit" to="." method="_on_quit_pressed"]
|
||||
132
project.godot
Normal file
132
project.godot
Normal file
@@ -0,0 +1,132 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
_global_script_classes=[{
|
||||
"base": "Module",
|
||||
"class": &"Cannon",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Modules/Cannon.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": &"Game",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Logic/Game.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": &"MapNode",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Logic/MapNode.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": &"Module",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Modules/Module.gd"
|
||||
}, {
|
||||
"base": "Module",
|
||||
"class": &"Storage",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Modules/Storage.gd"
|
||||
}, {
|
||||
"base": "MapNode",
|
||||
"class": &"StraightMapNode",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Logic/StraightMapNode.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": &"Train",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Train.gd"
|
||||
}, {
|
||||
"base": "Module",
|
||||
"class": &"TrainEngine",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Modules/Engine.gd"
|
||||
}, {
|
||||
"base": "StraightMapNode",
|
||||
"class": &"TurnMapNode",
|
||||
"language": &"GDScript",
|
||||
"path": "res://scripts/Logic/TurnMapNode.gd"
|
||||
}]
|
||||
_global_script_class_icons={
|
||||
"Cannon": "",
|
||||
"Game": "",
|
||||
"MapNode": "",
|
||||
"Module": "",
|
||||
"Storage": "",
|
||||
"StraightMapNode": "",
|
||||
"Train": "",
|
||||
"TrainEngine": "",
|
||||
"TurnMapNode": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Semester Game Jam 2022"
|
||||
run/main_scene="res://menu/main_menu.tscn"
|
||||
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[input]
|
||||
|
||||
test={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p1_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p1_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p1_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p1_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p1_interact={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":71,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p2_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p2_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p2_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p2_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
p2_interact={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":46,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
69
scripts/Logic/Game.gd
Normal file
69
scripts/Logic/Game.gd
Normal file
@@ -0,0 +1,69 @@
|
||||
extends Node
|
||||
class_name Game
|
||||
|
||||
const CHILL = 0
|
||||
const FIGHTING = 1
|
||||
|
||||
|
||||
#Signals
|
||||
signal ammo_pickup
|
||||
signal shoot
|
||||
|
||||
var fight_state = CHILL
|
||||
|
||||
var t = 0.0
|
||||
|
||||
@onready var p1_train = $Player1 as Train
|
||||
@onready var p2_train = $Player2 as Train
|
||||
|
||||
@onready var StartNode = $StartNode
|
||||
var p1_node : MapNode
|
||||
var p2_node : MapNode
|
||||
|
||||
func _ready():
|
||||
p1_node = StartNode
|
||||
p2_node = StartNode
|
||||
p2_train.get_node("CharacterBody3D").is_player1 = false
|
||||
p2_train.is_P1 = false
|
||||
p1_train.current_speed = 10
|
||||
p1_train.hit.connect(_on_hit_player)
|
||||
p2_train.hit.connect(_on_hit_player)
|
||||
|
||||
|
||||
func _on_hit_player(player1,dmg):
|
||||
if not player1:
|
||||
p2_train.current_speed -= dmg
|
||||
else:
|
||||
p1_train.current_speed -= dmg
|
||||
|
||||
func _process(delta):
|
||||
p1_train.current_distance += p1_train.current_speed * delta
|
||||
p2_train.current_distance += p2_train.current_speed * delta
|
||||
|
||||
if(p1_train.current_distance >= p1_node.LENGTH):
|
||||
var distance_delta = p1_train.current_distance - p1_node.LENGTH
|
||||
p1_node = p1_node._on_train_exit(p1_train)
|
||||
p1_train.current_distance = distance_delta
|
||||
|
||||
if(p2_train.current_distance >= p2_node.LENGTH):
|
||||
var distance_delta = p2_train.current_distance - p2_node.LENGTH
|
||||
p2_node = p2_node._on_train_exit(p2_train)
|
||||
p2_train.current_distance = distance_delta
|
||||
|
||||
if(p1_node == p2_node && p1_train.current_distance - p2_train.current_distance < 2):
|
||||
if(fight_state == CHILL):
|
||||
var tween = create_tween()
|
||||
tween.tween_property($Camera3D, "position", Vector3(0,10,0), 1)
|
||||
fight_state = FIGHTING
|
||||
else:
|
||||
fight_state = CHILL
|
||||
var tween = create_tween()
|
||||
tween.tween_property($Camera3D, "position", Vector3(0,20,0), 1)
|
||||
|
||||
|
||||
if Input.is_action_pressed("test"):
|
||||
emit_signal("shoot")
|
||||
|
||||
|
||||
|
||||
|
||||
14
scripts/Logic/MapNode.gd
Normal file
14
scripts/Logic/MapNode.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Node
|
||||
class_name MapNode
|
||||
|
||||
const LENGTH = 10
|
||||
const PICKUP = 0
|
||||
var previous : MapNode
|
||||
|
||||
var current_trains = []
|
||||
|
||||
func _on_train_entered(train):
|
||||
current_trains.append(train)
|
||||
|
||||
func _on_train_exit(train):
|
||||
current_trains.erase(train)
|
||||
9
scripts/Logic/StraightMapNode.gd
Normal file
9
scripts/Logic/StraightMapNode.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends MapNode
|
||||
class_name StraightMapNode
|
||||
|
||||
@export var next : MapNode
|
||||
|
||||
func _on_train_exit(train):
|
||||
next._on_train_entered(train)
|
||||
super._on_train_exit(train)
|
||||
return next
|
||||
21
scripts/Logic/TurnMapNode.gd
Normal file
21
scripts/Logic/TurnMapNode.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends StraightMapNode
|
||||
class_name TurnMapNode
|
||||
|
||||
signal turnEvent
|
||||
|
||||
var turn = false
|
||||
@export var is_left_turn = false
|
||||
@export var turn_node : MapNode
|
||||
|
||||
func _on_train_entered(train):
|
||||
super._on_train_entered(train)
|
||||
turnEvent.emit()
|
||||
|
||||
func _on_train_exit(train):
|
||||
if(turn):
|
||||
turn_node._on_train_entered(train)
|
||||
current_trains.erase(train)
|
||||
return turn_node
|
||||
else:
|
||||
super._on_train_exit(train)
|
||||
return next
|
||||
38
scripts/Modules/Cannon.gd
Normal file
38
scripts/Modules/Cannon.gd
Normal file
@@ -0,0 +1,38 @@
|
||||
extends Module
|
||||
|
||||
class_name Cannon
|
||||
|
||||
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
||||
|
||||
var CAN_ENGAGE = true
|
||||
var DAMAGE = 5
|
||||
@onready var train = get_parent() as Train
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
maxStashValue = 1
|
||||
currentStashValue = 1
|
||||
currentState = STATE.INACTIVE
|
||||
#TODO: FINISH
|
||||
func interact():
|
||||
if currentState == STATE.INACTIVE:
|
||||
#TODO: RELOADING
|
||||
if currentStashValue < maxStashValue:
|
||||
currentState = STATE.RELOADING
|
||||
currentStashValue += 1
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func shoot():
|
||||
if not CAN_ENGAGE:
|
||||
return false
|
||||
CAN_ENGAGE = false
|
||||
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)
|
||||
|
||||
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
|
||||
currentState = STATE.SHOOTING
|
||||
currentStashValue -= 1
|
||||
currentState = STATE.INACTIVE
|
||||
return true
|
||||
return false
|
||||
25
scripts/Modules/Engine.gd
Normal file
25
scripts/Modules/Engine.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Module
|
||||
class_name TrainEngine
|
||||
|
||||
|
||||
enum STATE {RUNNING, DEAD}
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
var root = get_tree().root.get_child(0)
|
||||
maxStashValue = 100
|
||||
currentStashValue = 100
|
||||
currentState = STATE.RUNNING
|
||||
#TODO: FINISH
|
||||
func interact():
|
||||
if currentState == STATE.RUNNING:
|
||||
if currentStashValue < maxStashValue:
|
||||
currentStashValue += 10
|
||||
if currentStashValue > maxStashValue:
|
||||
currentStashValue = maxStashValue
|
||||
return
|
||||
#TODO: Repair Train
|
||||
currentState = STATE.RUNNING
|
||||
|
||||
|
||||
|
||||
47
scripts/Modules/Module.gd
Normal file
47
scripts/Modules/Module.gd
Normal file
@@ -0,0 +1,47 @@
|
||||
extends Node
|
||||
|
||||
class_name Module
|
||||
#-----------Parameters----------------'
|
||||
var currentStashValue = 0 : set = _set_currentStashValue, get = _get_currentStashValue
|
||||
|
||||
var maxStashValue = 0 : set = _set_maxStashValue, get = _get_maxStashValue
|
||||
|
||||
var currentState = null : set = _set_state, get = _get_state
|
||||
|
||||
var level = 0 : set = _set_level, get = _get_level
|
||||
|
||||
|
||||
|
||||
|
||||
enum MODULE_TYPE {CANNON, STEERING, ENGINE, STORAGE}
|
||||
|
||||
|
||||
|
||||
#------------Methods-------------#
|
||||
|
||||
|
||||
func interact():
|
||||
pass
|
||||
|
||||
|
||||
func _ready():
|
||||
var root = get_tree().root.get_child(0)
|
||||
|
||||
|
||||
#-----------Setter and Getter---------------#
|
||||
func _set_currentStashValue(newValue):
|
||||
currentStashValue = newValue
|
||||
func _get_currentStashValue():
|
||||
return currentStashValue
|
||||
func _set_maxStashValue(newValue):
|
||||
currentStashValue = newValue
|
||||
func _get_maxStashValue():
|
||||
return currentStashValue
|
||||
func _set_level(newValue):
|
||||
level = newValue
|
||||
func _get_level():
|
||||
return level
|
||||
func _set_state(newValue):
|
||||
currentState = newValue
|
||||
func _get_state():
|
||||
return currentState
|
||||
25
scripts/Modules/Storage.gd
Normal file
25
scripts/Modules/Storage.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Module
|
||||
|
||||
class_name Storage
|
||||
|
||||
enum TYPE {AMMO, GUNPOWDER, FUEL}
|
||||
|
||||
@export var currentType: TYPE
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
var root = get_tree().root.get_child(0)
|
||||
root.ammo_pickup.connect(_on_signal_storing)
|
||||
maxStashValue = 5
|
||||
currentStashValue = 0
|
||||
func interact():
|
||||
if currentStashValue >= 1:
|
||||
currentStashValue -= 1
|
||||
|
||||
return
|
||||
|
||||
func _on_signal_storing():
|
||||
if currentStashValue < maxStashValue:
|
||||
currentStashValue += 1
|
||||
return
|
||||
|
||||
59
scripts/Player.gd
Normal file
59
scripts/Player.gd
Normal file
@@ -0,0 +1,59 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
#-----------Parameters--------------#
|
||||
var SPEED = 10
|
||||
var movement = Vector3(0,0,0)
|
||||
var collisionLayer = 3
|
||||
var inventory = 0 #1 - full, 0 - empty inventory
|
||||
var resource = 0
|
||||
|
||||
var is_alive = true
|
||||
@onready var is_player1 = true
|
||||
|
||||
#---------------Methods--------------#
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
movement = Vector3(0,0,0)
|
||||
|
||||
check_interaction()
|
||||
check_input()
|
||||
velocity = movement * SPEED
|
||||
move_and_slide()
|
||||
|
||||
func check_input():
|
||||
|
||||
if is_player1:
|
||||
if Input.is_action_pressed("p1_left"):
|
||||
movement.x -= 1
|
||||
if Input.is_action_pressed("p1_right"):
|
||||
movement.x += 1
|
||||
if Input.is_action_pressed("p1_up"):
|
||||
movement.z -= 1
|
||||
if Input.is_action_pressed("p1_down"):
|
||||
movement.z += 1
|
||||
else:
|
||||
if Input.is_action_pressed("p2_left"):
|
||||
movement.x -= 1
|
||||
if Input.is_action_pressed("p2_right"):
|
||||
movement.x += 1
|
||||
if Input.is_action_pressed("p2_up"):
|
||||
movement.z -= 1
|
||||
if Input.is_action_pressed("p2_down"):
|
||||
movement.z += 1
|
||||
|
||||
func check_interaction():
|
||||
var action
|
||||
if is_player1:
|
||||
action = "p1_interact"
|
||||
else:
|
||||
action = "p2_interact"
|
||||
|
||||
if Input.is_action_just_pressed(action):
|
||||
for body in $HitBox.get_overlapping_bodies():
|
||||
if body is Module:
|
||||
#Storage interaction
|
||||
if not inventory && body is Storage:
|
||||
body.interact()
|
||||
elif inventory && not body is Storage:
|
||||
body.interact()
|
||||
33
scripts/Train.gd
Normal file
33
scripts/Train.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Node
|
||||
class_name Train
|
||||
|
||||
signal hit(player, dmg)
|
||||
signal game_over
|
||||
|
||||
var is_P1 = true
|
||||
var current_distance = 0
|
||||
var current_speed = 5
|
||||
var CANNONS = []
|
||||
var STORAGES = []
|
||||
#@onready var ENGINE = $Module/Engine
|
||||
|
||||
@onready var root = get_tree().root.get_child(0) as Game
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
if(child is Cannon):
|
||||
CANNONS.append(child)
|
||||
if(child is Storage):
|
||||
STORAGES.append(child)
|
||||
root.shoot.connect(_on_signal_shooting)
|
||||
|
||||
|
||||
func _on_signal_shooting():
|
||||
for cannon in CANNONS:
|
||||
if cannon.shoot():
|
||||
hit.emit(is_P1,cannon.DAMAGE)
|
||||
|
||||
func is_dead():
|
||||
if current_speed <= 0:
|
||||
game_over.emit()
|
||||
|
||||
Reference in New Issue
Block a user