18 lines
347 B
GDScript3
18 lines
347 B
GDScript3
|
extends RigidBody
|
||
|
class_name Entity
|
||
|
|
||
|
const DEFAULT_GRAVITY = 0
|
||
|
const DEFAULT_MASS = 1
|
||
|
|
||
|
func _init():
|
||
|
gravity_scale = DEFAULT_GRAVITY
|
||
|
mass = DEFAULT_MASS
|
||
|
contact_monitor = true
|
||
|
contacts_reported = 10
|
||
|
connect("body_entered", self, "_on_body_entered")
|
||
|
|
||
|
|
||
|
func _on_body_entered(body):
|
||
|
if has_method("body_entered"):
|
||
|
call("body_entered", body)
|