Merge branch 'main' of github.com:PfandBoss/SemesterGameJam2022

This commit is contained in:
2022-12-10 02:29:37 +01:00
7 changed files with 167 additions and 0 deletions

31
Cannon.gd Normal file
View File

@@ -0,0 +1,31 @@
extends Module
class_name Cannon
enum STATE {INACTIVE, RELOADING, SHOOTING}
#------------Methods-------------#
func _ready():
var root = get_tree().root.get_child(0)
root.shooting.connect(_on_signal_shooting)
maxStashValue = 1
currentStashValue = 0
currentState = STATE.INACTIVE
#TODO: FINISH
func interact():
if currentState == STATE.INACTIVE:
#TODO: RELOADING
if currentStashValue < maxStashValue:
currentState = STATE.RELOADING
++currentStashValue
return
return
func _on_signal_shooting():
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
currentState = STATE.SHOOTING
--currentStashValue
#TODO: SHOOTING
currentState = STATE.INACTIVE
return

26
Engine.gd Normal file
View File

@@ -0,0 +1,26 @@
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
Module.gd Normal file
View 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

6
Module.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b87b68ghm4dkk"]
[ext_resource type="Script" path="res://Module.gd" id="1_42v8k"]
[node name="Node" type="Node"]
script = ExtResource("1_42v8k")

23
Storage.gd Normal file
View File

@@ -0,0 +1,23 @@
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.shooting.connect(_on_signal_storing)
maxStashValue = 5
currentStashValue = 0
func interact():
if currentStashValue >= 1:
--currentStashValue
return
func _on_signal_storing():
if currentStashValue < maxStashValue:
++currentStashValue
return

6
cannon.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://d2g0of2prwwj4"]
[ext_resource type="Script" path="res://Cannon.gd" id="1_mopo1"]
[node name="Cannon" type="Node"]
script = ExtResource("1_mopo1")

View File

@@ -8,6 +8,34 @@
config_version=5 config_version=5
_global_script_classes=[{
"base": "Module",
"class": &"Cannon",
"language": &"GDScript",
"path": "res://Cannon.gd"
}, {
"base": "Node",
"class": &"Module",
"language": &"GDScript",
"path": "res://Module.gd"
}, {
"base": "Module",
"class": &"Storage",
"language": &"GDScript",
"path": "res://Storage.gd"
}, {
"base": "Module",
"class": &"TrainEngine",
"language": &"GDScript",
"path": "res://Engine.gd"
}]
_global_script_class_icons={
"Cannon": "",
"Module": "",
"Storage": "",
"TrainEngine": ""
}
[application] [application]
config/name="Semester Game Jam 2022" config/name="Semester Game Jam 2022"