created abstract scripts for machine, drone, suit and mech
This commit is contained in:
42
rougelikeaboutmechs/Machines/Machine_Globals.gd
Normal file
42
rougelikeaboutmechs/Machines/Machine_Globals.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
enum drone_body_slots{
|
||||
BRAIN,
|
||||
LEGS,
|
||||
BODY,
|
||||
FUELTANK,
|
||||
HEAD
|
||||
}
|
||||
|
||||
enum suit_body_slots{
|
||||
ARMS,
|
||||
LEGS,
|
||||
BODY,
|
||||
HELMET,
|
||||
FUELTANK,
|
||||
BACKPACK
|
||||
}
|
||||
|
||||
enum mech_body_slots{
|
||||
COCKPIT,
|
||||
LEFT_ARM,
|
||||
RIGHT_ARM,
|
||||
RIGHT_LEG,
|
||||
LEFT_LEG,
|
||||
CHEST,
|
||||
BACK,
|
||||
FUELTANK,
|
||||
TRUNK
|
||||
}
|
||||
|
||||
enum regular_states{
|
||||
IDLING,
|
||||
WALKING,
|
||||
DASHING,
|
||||
INTERACTING
|
||||
}
|
||||
|
||||
enum irregular_states{
|
||||
INVULNERABLE,
|
||||
OVERCLOCKED,
|
||||
STUNNED,
|
||||
SNARRED
|
||||
}
|
||||
1
rougelikeaboutmechs/Machines/Machine_Globals.gd.uid
Normal file
1
rougelikeaboutmechs/Machines/Machine_Globals.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bb8l1fmenh8j0
|
||||
15
rougelikeaboutmechs/Machines/drone_machine.gd
Normal file
15
rougelikeaboutmechs/Machines/drone_machine.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
@abstract
|
||||
extends Machine
|
||||
class_name Drone
|
||||
|
||||
@export_category("Dash")
|
||||
@export var dodge_cd : float
|
||||
|
||||
func _ready() -> void:
|
||||
add_on_slots = 1
|
||||
for a in MachineGlobals.drone_body_slots :
|
||||
machine_upgrades.set(a,null)
|
||||
|
||||
func class_ability() -> float:
|
||||
#do dash
|
||||
return dodge_cd
|
||||
1
rougelikeaboutmechs/Machines/drone_machine.gd.uid
Normal file
1
rougelikeaboutmechs/Machines/drone_machine.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cwocow55yssst
|
||||
47
rougelikeaboutmechs/Machines/machine_abstract.gd
Normal file
47
rougelikeaboutmechs/Machines/machine_abstract.gd
Normal file
@@ -0,0 +1,47 @@
|
||||
@abstract
|
||||
class_name Machine
|
||||
extends Node
|
||||
|
||||
@export var model_name : StringName
|
||||
@export var carry_capacity : float
|
||||
@export var hit_points : float
|
||||
@export var fuel_tank_capacity : float
|
||||
@export var movement_speed : float
|
||||
var states : Array
|
||||
var add_on_slots : int
|
||||
var machine_upgrades : Dictionary
|
||||
var ability_timer : Timer
|
||||
var action_timer : Timer
|
||||
var self_body : CharacterBody2D
|
||||
var current_fuel_in_tank : float
|
||||
|
||||
|
||||
@abstract func primary_action() -> float
|
||||
@abstract func secondary_action() -> float
|
||||
|
||||
@abstract func model_ability() -> float
|
||||
@abstract func class_ability() -> float
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
_movement(delta)
|
||||
_ability_process(delta)
|
||||
_action_process(delta)
|
||||
self_body.move_and_slide()
|
||||
|
||||
func _movement(delta: float) -> void :
|
||||
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
self.velocity = input_direction * movement_speed
|
||||
|
||||
func _action_process(delta:float) -> void :
|
||||
if action_timer.time_left > 0 :
|
||||
if Input.is_action_just_pressed("primary_action") :
|
||||
action_timer.start(primary_action())
|
||||
elif Input.is_action_just_pressed("secondary_action") :
|
||||
action_timer.start(secondary_action())
|
||||
|
||||
func _ability_process(delta:float) -> void :
|
||||
if ability_timer.time_left > 0 :
|
||||
if Input.is_action_just_pressed("class_ability") :
|
||||
ability_timer.start(class_ability())
|
||||
elif Input.is_action_just_pressed("model_ability") :
|
||||
ability_timer.start(model_ability())
|
||||
@@ -1,10 +0,0 @@
|
||||
extends Resource
|
||||
class_name machine
|
||||
|
||||
@export var modell_name : StringName
|
||||
@export var carry_capacity : float
|
||||
@export var hit_points : float
|
||||
@export var fuel_tank_capacity : float
|
||||
@export var weapon_slots : Array
|
||||
@export var machine_upgrades : Array
|
||||
var current_fuel_in_tank : float
|
||||
17
rougelikeaboutmechs/Machines/mech_machine.gd
Normal file
17
rougelikeaboutmechs/Machines/mech_machine.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
@abstract
|
||||
extends Machine
|
||||
class_name Mech
|
||||
|
||||
@export_category("Perry")
|
||||
@export var perry_cooldown : float
|
||||
@export var perry_damage_reduction : float
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_on_slots = 1
|
||||
for a in MachineGlobals.mech_body_slots :
|
||||
machine_upgrades.set(a,null)
|
||||
|
||||
func class_ability() -> float:
|
||||
#do perry
|
||||
return perry_cooldown
|
||||
1
rougelikeaboutmechs/Machines/mech_machine.gd.uid
Normal file
1
rougelikeaboutmechs/Machines/mech_machine.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://db7ysbxl5n433
|
||||
18
rougelikeaboutmechs/Machines/suit_machine.gd
Normal file
18
rougelikeaboutmechs/Machines/suit_machine.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
@abstract
|
||||
extends Machine
|
||||
class_name Suit
|
||||
|
||||
@export_category("Overclock")
|
||||
@export_range(1,5,0.01) var overclock_fuel_mult : float
|
||||
@export var overclock_damage_mult : float
|
||||
@export var overclock_speed_mult : float
|
||||
@export var overclock_vulnerability_mult : float
|
||||
|
||||
func _ready() -> void:
|
||||
add_on_slots = 2
|
||||
for a in MachineGlobals.suit_body_slots :
|
||||
machine_upgrades.set(a,null)
|
||||
|
||||
func class_ability() -> float:
|
||||
#enter overclocked mode
|
||||
return 0
|
||||
1
rougelikeaboutmechs/Machines/suit_machine.gd.uid
Normal file
1
rougelikeaboutmechs/Machines/suit_machine.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dundnjnepv3e7
|
||||
Reference in New Issue
Block a user