mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-15 22:50:20 +02:00
Added Level Indicators to Cards
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
extends TextureRect
|
extends TextureRect
|
||||||
#CardDeck
|
# CardDeck
|
||||||
export var Item:PackedScene
|
export var Item:PackedScene
|
||||||
export var PreviewIcon:Texture
|
export var PreviewIcon:Texture
|
||||||
export var DeleteOnGrab:bool = false
|
export var DeleteOnGrab:bool = false
|
||||||
@@ -8,28 +8,31 @@ export var DeleteOnGrab:bool = false
|
|||||||
func get_drag_data(_pos):
|
func get_drag_data(_pos):
|
||||||
var ctrl = Control.new()
|
var ctrl = Control.new()
|
||||||
var TR = TextureRect.new()
|
var TR = TextureRect.new()
|
||||||
TR.texture = get_resized_texture(PreviewIcon,self.rect_size[0],self.rect_size[1])
|
TR.texture = get_resized_texture(PreviewIcon, self.rect_size[0], self.rect_size[1])
|
||||||
TR.rect_size= self.rect_size
|
TR.rect_size = self.rect_size
|
||||||
TR.set_position(_pos*-1,false)
|
TR.set_position(_pos * -1, false)
|
||||||
ctrl.add_child(TR)
|
ctrl.add_child(TR)
|
||||||
set_drag_preview(ctrl)
|
set_drag_preview(ctrl)
|
||||||
|
|
||||||
if DeleteOnGrab :
|
if DeleteOnGrab:
|
||||||
self.queue_free()
|
self.queue_free()
|
||||||
return Item
|
return Item
|
||||||
|
|
||||||
|
|
||||||
#stuff can be dropped here
|
#stuff can be dropped here
|
||||||
#eg you picked the wrong thing up, let go and it returns to nothingness
|
#eg you picked the wrong thing up, let go and it returns to nothingness
|
||||||
func can_drop_data(_pos, data):
|
func can_drop_data(_pos, data):
|
||||||
return typeof(data) == typeof(PackedScene)
|
return typeof(data) == typeof(PackedScene)
|
||||||
|
|
||||||
|
|
||||||
#do nothing if stuff is dropped here
|
#do nothing if stuff is dropped here
|
||||||
func drop_data(_pos, _data):
|
func drop_data(_pos, _data):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func get_resized_texture(t: Texture, width: int = 0, height: int = 0):
|
func get_resized_texture(t: Texture, width: int = 0, height: int = 0):
|
||||||
var image = t.get_data()
|
var image = t.get_data()
|
||||||
if width > 0 && height > 0:
|
if width > 0 and height > 0:
|
||||||
image.resize(width, height)
|
image.resize(width, height)
|
||||||
var itex = ImageTexture.new()
|
var itex = ImageTexture.new()
|
||||||
itex.create_from_image(image,0)
|
itex.create_from_image(image,0)
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://Objects/Card/card.png" type="Texture" id=2]
|
[ext_resource path="res://Objects/Card/card.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://Menus/DragNDrop/DragSource.gd" type="Script" id=3]
|
[ext_resource path="res://Menus/DragNDrop/DragSource.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://Objects/Card/level0.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://Objects/Card/level2.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://Objects/Card/level1.png" type="Texture" id=6]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=1]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 4 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "lvl0",
|
||||||
|
"speed": 60.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 5 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "lvl2",
|
||||||
|
"speed": 60.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 6 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "lvl1",
|
||||||
|
"speed": 60.0
|
||||||
|
} ]
|
||||||
|
|
||||||
[node name="DragSource" type="TextureRect"]
|
[node name="DragSource" type="TextureRect"]
|
||||||
margin_left = 10.7364
|
margin_left = 10.7364
|
||||||
@@ -17,6 +38,11 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
position = Vector2( 16.0791, 16.0117 )
|
position = Vector2( 15.729, 15.7929 )
|
||||||
z_index = -1
|
z_index = -1
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||||
|
position = Vector2( 33.1035, 40.3068 )
|
||||||
|
frames = SubResource( 1 )
|
||||||
|
animation = "lvl0"
|
||||||
|
|||||||
BIN
src/Objects/Card/level0.png
Normal file
BIN
src/Objects/Card/level0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 137 B |
34
src/Objects/Card/level0.png.import
Normal file
34
src/Objects/Card/level0.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/level0.png-da2388fe9991aba155f4f030f573f288.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/Card/level0.png"
|
||||||
|
dest_files=[ "res://.import/level0.png-da2388fe9991aba155f4f030f573f288.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=false
|
||||||
|
svg/scale=1.0
|
||||||
BIN
src/Objects/Card/level1.png
Normal file
BIN
src/Objects/Card/level1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 B |
34
src/Objects/Card/level1.png.import
Normal file
34
src/Objects/Card/level1.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/level1.png-ab0efb90911fd7134ef5c5c3c34ffe82.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/Card/level1.png"
|
||||||
|
dest_files=[ "res://.import/level1.png-ab0efb90911fd7134ef5c5c3c34ffe82.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=false
|
||||||
|
svg/scale=1.0
|
||||||
BIN
src/Objects/Card/level2.png
Normal file
BIN
src/Objects/Card/level2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 B |
34
src/Objects/Card/level2.png.import
Normal file
34
src/Objects/Card/level2.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/level2.png-377010b68cc608f506f01e4ccb424729.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/Card/level2.png"
|
||||||
|
dest_files=[ "res://.import/level2.png-377010b68cc608f506f01e4ccb424729.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=false
|
||||||
|
svg/scale=1.0
|
||||||
Reference in New Issue
Block a user