#18 ajout de la classe UndergroundLoot et aparition de loot par jour
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="121.41377mm"
|
||||
height="49.165478mm"
|
||||
viewBox="0 0 121.41377 49.165478"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#ffffff"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="mm" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-77.923929,-55.520125)">
|
||||
<path
|
||||
id="path1"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
|
||||
d="M 141.47612,55.520125 A 35.11824,35.11824 0 0 0 107.53969,81.850818 26.422297,26.422297 0 0 0 104.01691,81.607939 26.422297,26.422297 0 0 0 77.923926,104.6856 H 199.239 a 28.094591,28.094591 0 0 0 0.0987,-1.00304 28.094591,28.094591 0 0 0 -26.09504,-28.015344 35.11824,35.11824 0 0 0 -31.76654,-20.147091 z" />
|
||||
<path
|
||||
id="path2"
|
||||
style="fill:#c9c9c9;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
|
||||
d="M 149.00176,77.594747 A 22.241554,22.241554 0 0 0 127.96997,92.741626 22.241554,22.241554 0 0 0 117.22799,89.969702 22.241554,22.241554 0 0 0 96.380164,104.6856 h 95.746606 a 22.241554,22.241554 0 0 0 -21.05091,-15.385108 22.241554,22.241554 0 0 0 -2.3983,0.171566 22.241554,22.241554 0 0 0 -19.6758,-11.877311 z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bu26h0iqutnky"
|
||||
path="res://.godot/imported/underground_loot.svg-94513f7cc11df7cda1992e530bcff786.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/underground_loot/assets/sprites/underground_loot.svg"
|
||||
dest_files=["res://.godot/imported/underground_loot.svg-94513f7cc11df7cda1992e530bcff786.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
48
entities/underground_loot/scripts/underground_loot.gd
Normal file
48
entities/underground_loot/scripts/underground_loot.gd
Normal file
@@ -0,0 +1,48 @@
|
||||
extends Area2D
|
||||
class_name UndergroundLoot
|
||||
|
||||
const AREA_WIDTH = 10
|
||||
const LOOTED_ITEM_RANDOM_RANGE = 100
|
||||
|
||||
const SPRITE_SCENE : PackedScene = preload("res://entities/underground_loot/underground_loot_sprite.tscn")
|
||||
|
||||
@export var loot : Array[Item]
|
||||
var planet : Planet # mis à jour par la classe Planet
|
||||
|
||||
@onready var sprite_object: Node2D = generate_sprite()
|
||||
@onready var collision_shape: CollisionShape2D = generate_collision_shape()
|
||||
|
||||
func _init(_planet = null):
|
||||
planet = _planet
|
||||
|
||||
func generate_sprite() -> Node2D:
|
||||
var object = SPRITE_SCENE.instantiate()
|
||||
|
||||
add_child(object)
|
||||
|
||||
return object
|
||||
|
||||
func generate_collision_shape() -> CollisionShape2D:
|
||||
var collision = CollisionShape2D.new()
|
||||
var shape = CircleShape2D.new()
|
||||
shape.radius = AREA_WIDTH
|
||||
|
||||
collision.shape = shape
|
||||
add_child(collision)
|
||||
|
||||
return collision
|
||||
|
||||
func dig():
|
||||
for item in loot:
|
||||
var item_object = planet.drop_item(item, global_position)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
Vector2(
|
||||
item_object.position.x + randi()%LOOTED_ITEM_RANDOM_RANGE,
|
||||
item_object.position.y + randi()%LOOTED_ITEM_RANDOM_RANGE
|
||||
),
|
||||
0.2
|
||||
)
|
||||
queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dfd2hh12155lo
|
||||
10
entities/underground_loot/underground_loot_sprite.tscn
Normal file
10
entities/underground_loot/underground_loot_sprite.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dxjud7bti0na0"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bu26h0iqutnky" path="res://entities/underground_loot/assets/sprites/underground_loot.svg" id="1_t1xxm"]
|
||||
|
||||
[node name="UndergroundLootSprites" type="Node2D"]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.286275, 0.219608, 0.313726, 1)
|
||||
scale = Vector2(0.0806452, 0.0806452)
|
||||
texture = ExtResource("1_t1xxm")
|
||||
Reference in New Issue
Block a user