develop #30
@ -1,11 +1,15 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
export var enabled: bool = false
|
||||||
export var development_url: String = "http://localhost:4050/api/v1"
|
export var development_url: String = "http://localhost:4050/api/v1"
|
||||||
var url_real: String = "https://alai.cromer.cl/api/v1"
|
var url_real: String = "https://alai.cromer.cl/api/v1"
|
||||||
export var use_development_url: bool = false
|
export var use_development_url: bool = false
|
||||||
onready var url: String = development_url if use_development_url else url_real
|
onready var url: String = development_url if use_development_url else url_real
|
||||||
|
|
||||||
|
var start_time: int = 0
|
||||||
|
var started: bool = false
|
||||||
|
|
||||||
var player: Dictionary = {}
|
var player: Dictionary = {}
|
||||||
var level_id: int = 2 # PrototypeR
|
var level_id: int = 2 # PrototypeR
|
||||||
var os_id: int = 0
|
var os_id: int = 0
|
||||||
@ -23,7 +27,6 @@ var frames: Array = []
|
|||||||
|
|
||||||
var coins: int = 0
|
var coins: int = 0
|
||||||
var points: int = 0
|
var points: int = 0
|
||||||
onready var start_time: int = OS.get_ticks_msec()
|
|
||||||
var objects: Array = []
|
var objects: Array = []
|
||||||
|
|
||||||
const empty_object: Dictionary = {
|
const empty_object: Dictionary = {
|
||||||
@ -96,6 +99,7 @@ func _ready() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
|
if enabled and started:
|
||||||
var frame = empty_frame.duplicate(true)
|
var frame = empty_frame.duplicate(true)
|
||||||
frame["coins"] = coins
|
frame["coins"] = coins
|
||||||
frame["points"] = points
|
frame["points"] = points
|
||||||
@ -112,18 +116,30 @@ func _physics_process(_delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _object_created(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
func _object_created(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
||||||
|
if enabled and started:
|
||||||
add_object(name, state, position, velocity)
|
add_object(name, state, position, velocity)
|
||||||
|
|
||||||
|
|
||||||
func _object_updated(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
func _object_updated(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
||||||
|
if enabled and started:
|
||||||
remove_object(name)
|
remove_object(name)
|
||||||
add_object(name, state, position, velocity)
|
add_object(name, state, position, velocity)
|
||||||
|
|
||||||
|
|
||||||
func _object_removed(name: String) -> void:
|
func _object_removed(name: String) -> void:
|
||||||
|
if enabled and started:
|
||||||
remove_object(name)
|
remove_object(name)
|
||||||
|
|
||||||
|
|
||||||
|
func start_monitor() -> void:
|
||||||
|
start_time = OS.get_ticks_msec()
|
||||||
|
started = true
|
||||||
|
|
||||||
|
|
||||||
|
func stop_monitor() -> void:
|
||||||
|
started = false
|
||||||
|
|
||||||
|
|
||||||
func add_object(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
func add_object(name: String, state: String, position: Vector2, velocity: Vector2) -> void:
|
||||||
var object = empty_object.duplicate(true)
|
var object = empty_object.duplicate(true)
|
||||||
object["name"] = name
|
object["name"] = name
|
||||||
|
Loading…
Reference in New Issue
Block a user