Created
June 19, 2023 14:12
-
-
Save default1200/8ff6b72417894afeb8e9d9ad3b17f3c9 to your computer and use it in GitHub Desktop.
Actor GD with raycast and direction
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
extends KinematicBody2D | |
class_name Actor | |
var direction = -1 | |
func _ready(): | |
if direction == 1.0: | |
$RayCast2D.position.x = $collisionShape2D.shape.get_extents().x * direction | |
const FLOOR_NORMAL: = Vector2.UP | |
export var speed: = Vector2(300.0, 1000.0) | |
export var gravity: = 4000.0 | |
var velocity: = Vector2.ZERO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment