simple composable grid context and grid controller, fiend sprite, godotxel addon
This commit is contained in:
8
nodes/singletons/Arithmetic.gd
Normal file
8
nodes/singletons/Arithmetic.gd
Normal file
@ -0,0 +1,8 @@
|
||||
extends Node
|
||||
class_name TK_Arithmetic
|
||||
|
||||
static func float_mod(p_a: float, p_b: float) -> float:
|
||||
return p_a - (p_b * floor(p_a / p_b))
|
||||
|
||||
static func vector2_mod(p_a: Vector2, p_b: Vector2) -> Vector2:
|
||||
return p_a - (p_b * (p_a / p_b).floor())
|
13
nodes/singletons/InputUtils.gd
Normal file
13
nodes/singletons/InputUtils.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Node
|
||||
|
||||
func input_event_to_4way_direction(p_event: InputEvent) -> Vector2:
|
||||
var result := Vector2.ZERO
|
||||
if p_event.is_action_pressed("move_down"):
|
||||
result.y += 1
|
||||
if p_event.is_action_pressed("move_right"):
|
||||
result.x += 1
|
||||
if p_event.is_action_pressed("move_up"):
|
||||
result.y -= 1
|
||||
if p_event.is_action_pressed("move_left"):
|
||||
result.x -= 1
|
||||
return result
|
Reference in New Issue
Block a user