Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | linuxfree | |
Old Version | Published before Godot 3 was released. |
here my script i tryng do no collision with this 2 objects bu no have sucess
extends RigidBody2D # this is a enemy
var rock_large = preload(“res://rocks/rock_scene.scn”).instance() # a scene rock loaded
var duraRock = 20
var points = 500
var loop_anim = 0
var timeElapsed = 0
func _ready():
set_fixed_process(true)
apply_impulse(get_pos(), Vector2(0, 0))
set_angular_velocity(rand_range(0, 0))
set_gravity_scale(0)
func _fixed_process(delta):
do somenthing…
if (Globals.has(“gameStarting”)):
print(“duraRock do inimigo :”, duraRock)
get_node(".").add_collision_exception_with(rock_large.get_node("RigidBody2D"))
if (Globals.get(“gameStarting”) == false):
get_node(“.”).queue_free() # delete all node if not Started
if (duraRock == 0):
if Globals.has("score"):
Globals.set("score", Globals.get("score") + points)
get_node(".").queue_free() # delete all node
this line → get_node(“.”).add_collision_exception_with(rock_large.get_node(“RigidBody2D”))
no have efect please help me