-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27289ed
commit 40a3dc2
Showing
13 changed files
with
106 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 23 additions & 80 deletions
103
project/Prepped Assets/Characters/PlayerRPG/RayCast2D.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,29 @@ | ||
extends Node | ||
@export var ray_01 : RayCast2D | ||
@export var ray_02 : RayCast2D | ||
@export var ray_03 : RayCast2D | ||
var active | ||
signal ray1 | ||
signal ray2 | ||
signal ray3 | ||
signal noray1 | ||
signal noray2 | ||
signal noray3 | ||
extends RayCast2D | ||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
pass # Replace with function body. | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
if Input.is_action_pressed("left"): | ||
ray_02.enabled = false | ||
ray_02.force_raycast_update() | ||
#ray_02.visible = false | ||
ray_03.enabled = false | ||
ray_03.force_raycast_update() | ||
#ray_03.visible = false | ||
ray_01.enabled = true | ||
ray_01.force_raycast_update() | ||
#ray_01.visible = true | ||
ray_01.rotation_degrees = 90 | ||
active = ray_01 | ||
rotation_degrees = 90 | ||
position.y = -10 | ||
elif Input.is_action_pressed("right"): | ||
ray_02.enabled = false | ||
ray_02.force_raycast_update() | ||
#ray_02.visible = false | ||
ray_03.enabled = false | ||
ray_03.force_raycast_update() | ||
#ray_03.visible = false | ||
ray_01.enabled = true | ||
ray_01.force_raycast_update() | ||
#ray_01.visible = true | ||
ray_01.rotation_degrees = -90 | ||
active = ray_01 | ||
rotation_degrees = -90 | ||
position.y = -10 | ||
elif Input.is_action_pressed("up"): | ||
ray_01.enabled = false | ||
ray_01.force_raycast_update() | ||
#ray_01.visible = false | ||
ray_03.enabled = false | ||
ray_03.force_raycast_update() | ||
#ray_03.visible = false | ||
ray_02.enabled = true | ||
ray_02.force_raycast_update() | ||
#ray_02.visible = true | ||
active = ray_02 | ||
rotation_degrees = 180 | ||
position.y = -22 | ||
elif Input.is_action_pressed("down"): | ||
ray_01.enabled = false | ||
ray_01.force_raycast_update() | ||
#ray_01.visible = false | ||
ray_02.enabled = false | ||
ray_02.force_raycast_update() | ||
#ray_02.visible = false | ||
ray_03.enabled = true | ||
ray_03.force_raycast_update() | ||
#ray_03.visible = true | ||
active=ray_03 | ||
#print("colliding at: ", cellPosition) | ||
if active == ray_01: | ||
ray1.emit() | ||
noray2.emit() | ||
noray3.emit() | ||
#var collider = ray_01.get_collider() | ||
#if collider is TileMap: | ||
#var colliderPosition = ray_01.get_collision_point() | ||
#var cellPosition: Vector2 = collider.local_to_map(colliderPosition) | ||
#GlobalVariableLoader.cellPosition = cellPosition | ||
elif active == ray_02: | ||
ray2.emit() | ||
noray1.emit() | ||
noray3.emit() | ||
#var collider = ray_02.get_collider() | ||
#if collider is TileMap: | ||
#var colliderPosition = ray_02.get_collision_point() | ||
#var cellPosition: Vector2 = collider.local_to_map(colliderPosition) | ||
#GlobalVariableLoader.cellPosition = cellPosition | ||
elif active == ray_03: | ||
ray3.emit() | ||
noray1.emit() | ||
noray2.emit() | ||
#var collider = ray_03.get_collider() | ||
#if collider is TileMap: | ||
#var colliderPosition = ray_03.get_collision_point() | ||
#var cellPosition: Vector2 = collider.local_to_map(colliderPosition) | ||
rotation_degrees = 0 | ||
position.y = 1 | ||
var collider = get_collider() | ||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): | ||
if collider is TileMap: | ||
var colliderPosition = get_collision_point() | ||
var cellPosition: Vector2 = collider.local_to_map(colliderPosition) | ||
GlobalVariableLoader.cellPosition = cellPosition | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.