Tut19 Complete: Camera
This commit is contained in:
14
ActionRPG-HeartBeast/Overlap/SoftCollision.gd
Normal file
14
ActionRPG-HeartBeast/Overlap/SoftCollision.gd
Normal file
@ -0,0 +1,14 @@
|
||||
extends Area2D
|
||||
|
||||
func is_colliding():
|
||||
var areas = get_overlapping_areas()
|
||||
return areas.size() > 0
|
||||
|
||||
func get_push_vector():
|
||||
var areas = get_overlapping_areas()
|
||||
var push_vector = Vector2.ZERO
|
||||
if is_colliding():
|
||||
var area = areas[0]
|
||||
push_vector = area.global_position.direction_to(global_position)
|
||||
push_vector = push_vector.normalized()
|
||||
return push_vector
|
8
ActionRPG-HeartBeast/Overlap/SoftCollision.tscn
Normal file
8
ActionRPG-HeartBeast/Overlap/SoftCollision.tscn
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Overlap/SoftCollision.gd" type="Script" id=1]
|
||||
|
||||
[node name="SoftCollision" type="Area2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
Reference in New Issue
Block a user