Skip to content

Instantly share code, notes, and snippets.

@default1200
Created June 19, 2023 14:12
Show Gist options
  • Save default1200/8ff6b72417894afeb8e9d9ad3b17f3c9 to your computer and use it in GitHub Desktop.
Save default1200/8ff6b72417894afeb8e9d9ad3b17f3c9 to your computer and use it in GitHub Desktop.
Actor GD with raycast and direction
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