Fix collision generation issues

This commit is contained in:
Layla 2019-11-03 20:31:05 -05:00
parent a267be20ac
commit d9350f3f6d
4 changed files with 20 additions and 5 deletions

View File

@ -51,6 +51,7 @@ func _process(delta):
script = ExtResource( 1 )
[node name="LoadingScreen" type="CanvasLayer" parent="."]
editor/display_folded = true
script = SubResource( 1 )
[node name="ColorRect" type="ColorRect" parent="LoadingScreen"]

8
Nodes/Pickup.gd Normal file
View File

@ -0,0 +1,8 @@
extends Node2D
var tileMap
func _ready():
var tileMap = get_node("/root/World/TileMap")
var tilePos = tileMap.world_to_map(position)
if(tileMap.get_cell(tilePos.x, tilePos.y) != 0):
queue_free()

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Art/pickup1.png" type="Texture" id=1]
[ext_resource path="res://Art/pickup2.png" type="Texture" id=2]
[ext_resource path="res://Nodes/Pickup.gd" type="Script" id=1]
[ext_resource path="res://Art/pickup1.png" type="Texture" id=2]
[ext_resource path="res://Art/pickup2.png" type="Texture" id=3]
[sub_resource type="GDScript" id=1]
script/source = "extends Area2D
@ -19,13 +20,14 @@ extents = Vector2( 6, 6 )
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ ExtResource( 1 ), ExtResource( 2 ) ],
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
"loop": true,
"name": "default",
"speed": 10.0
} ]
[node name="Pickup" type="Node2D"]
script = ExtResource( 1 )
[node name="Area2D" type="Area2D" parent="."]
gravity = 0.0

View File

@ -3,8 +3,12 @@ extends Node2D
export var HP = 8
export var color = "ffff00"
var tileMap
func _ready():
pass
var tileMap = get_node("/root/World/TileMap")
var tilePos = tileMap.world_to_map(position)
if(tileMap.get_cell(tilePos.x, tilePos.y) != 0):
queue_free()
func take_damage(dmg):
playAudio("Bomb_Drop.wav")