108 lines
1.8 KiB
GDScript
108 lines
1.8 KiB
GDScript
extends Node
|
|
|
|
|
|
|
|
|
|
class_name Movement
|
|
|
|
#Setting up Other Classes
|
|
const Data = preload("res://Movement_Class.gd")
|
|
|
|
|
|
#Defining Raycasts
|
|
|
|
var Right : bool
|
|
var Left : bool
|
|
var Up : bool
|
|
var Down : bool
|
|
|
|
#External Data
|
|
|
|
var Detail_Dict: Dictionary
|
|
|
|
|
|
|
|
#Internal Data
|
|
|
|
var Prev_dir = ""
|
|
var Prev_dir_Opp = ""
|
|
|
|
|
|
|
|
var Current_Position = [0,0]
|
|
|
|
# Misc
|
|
var move = 0
|
|
var Move_Strength = 1
|
|
var State = 0
|
|
|
|
func _process(delta):
|
|
|
|
pass
|
|
|
|
func goDown():
|
|
var Data_Class = Data.new()
|
|
if Down == false:
|
|
Current_Position[1] -=1
|
|
print(Current_Position)
|
|
Prev_dir = "D"
|
|
Prev_dir_Opp = "U"
|
|
move += Move_Strength
|
|
Data_Class.Current_Position = Current_Position
|
|
else:
|
|
move += Move_Strength
|
|
print("There is something below you")
|
|
|
|
func goUp():
|
|
var Data_Class = Data.new()
|
|
if Up == false:
|
|
Current_Position[1] +=1
|
|
print(Current_Position)
|
|
Prev_dir = "U"
|
|
Prev_dir_Opp = "D"
|
|
move += Move_Strength
|
|
Data_Class.Current_Position = Current_Position
|
|
else:
|
|
move += Move_Strength
|
|
print("There is something above you")
|
|
|
|
func goRight():
|
|
var Data_Class = Data.new()
|
|
if Right == false:
|
|
Current_Position[0] +=1
|
|
print(Current_Position)
|
|
Prev_dir = "R"
|
|
Prev_dir_Opp = "L"
|
|
move += Move_Strength
|
|
Data_Class.Current_Position = Current_Position
|
|
else:
|
|
move += Move_Strength
|
|
print("There is something to your right")
|
|
|
|
func goLeft():
|
|
var Data_Class = Data.new()
|
|
if Left == false:
|
|
Current_Position[0] -=1
|
|
print(Current_Position)
|
|
Prev_dir = "L"
|
|
Prev_dir_Opp = "R"
|
|
move += Move_Strength
|
|
Data_Class.Current_Position = Current_Position
|
|
else:
|
|
move += Move_Strength
|
|
print("There is something to your left")
|
|
|
|
func WhatMove():
|
|
pass
|
|
if Detail_Dict.Been_There == true:
|
|
if State != 1:
|
|
Move_Strength = 0
|
|
move = move - 1
|
|
State = 1
|
|
|
|
if Detail_Dict.Been_There == false:
|
|
if State != 2:
|
|
Move_Strength = 1
|
|
move = move + 1
|
|
State = 2
|