Merge branch 'main' of https://gamejam.fachschaft.info/Florian/The_Dark_Side_of_Earth
This commit is contained in:
commit
e923619977
11 changed files with 68 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://djawvtdwp423v"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://djawvtdwp423v"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_5j34s"]
|
||||
[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_xx8ra"]
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="5_xr4t5"]
|
||||
[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="7_35wcg"]
|
||||
[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://platform.tscn" id="8_sifiv"]
|
||||
[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/item_spawn.tscn" id="9_i1qmw"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pfkkr"]
|
||||
shader = ExtResource("2_xx8ra")
|
||||
|
|
@ -59,6 +60,9 @@ position = Vector2(525, -285)
|
|||
position = Vector2(300, -150)
|
||||
scale = Vector2(2.688, 3)
|
||||
|
||||
[node name="ItemSpawn" parent="EnemyList" instance=ExtResource("9_i1qmw")]
|
||||
position = Vector2(300, -200)
|
||||
|
||||
[node name="DebugSprite" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(300, -150)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b00185vygcka1"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b00185vygcka1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b43fudwi47qfd" path="res://heal_item.gd" id="1_3vbv8"]
|
||||
[ext_resource type="Script" uid="uid://b43fudwi47qfd" path="res://items/heal_item.gd" id="1_3vbv8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_48lih"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_evqwq"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hvhjo"]
|
||||
|
||||
[node name="HealItem" type="Area2D"]
|
||||
script = ExtResource("1_3vbv8")
|
||||
|
||||
[node name="EarthAligner" parent="." instance=ExtResource("2_evqwq")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(7, 7)
|
||||
shape = SubResource("CircleShape2D_hvhjo")
|
||||
38
items/item_spawn.gd
Normal file
38
items/item_spawn.gd
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
class_name ItemSpawn extends Node2D
|
||||
|
||||
@export var common_items : Array[PackedScene]
|
||||
@export var rare_items : Array[PackedScene]
|
||||
@export var unique_items : Array[PackedScene]
|
||||
|
||||
@export var rarity_bonus = 0
|
||||
@export var guarantee_rare : bool = false
|
||||
|
||||
@export var unique_base_chance = .05
|
||||
@export var rare_base_chance = .2
|
||||
@export var unique_bonus_multiplier = .025
|
||||
@export var rare_bonus_multiplier = .1
|
||||
|
||||
var remove_after_spawn = false
|
||||
|
||||
func choose_pool() -> Array[PackedScene]:
|
||||
var unique_chance = unique_base_chance + unique_bonus_multiplier * rarity_bonus
|
||||
var rare_chance = unique_base_chance + unique_bonus_multiplier * rarity_bonus
|
||||
|
||||
var random = randf()
|
||||
if random < unique_chance && unique_items.size() > 0:
|
||||
remove_after_spawn = true
|
||||
return unique_items
|
||||
elif random < unique_chance + rare_chance || guarantee_rare:
|
||||
return rare_items
|
||||
|
||||
return common_items
|
||||
|
||||
func _ready():
|
||||
var pool = choose_pool()
|
||||
var index = randi_range(0, pool.size() - 1)
|
||||
var packed_scene : PackedScene = pool[index]
|
||||
pool.remove_at(index)
|
||||
var object = packed_scene.instantiate()
|
||||
add_child.call_deferred(object)
|
||||
object.reparent.call_deferred(get_parent())
|
||||
|
||||
1
items/item_spawn.gd.uid
Normal file
1
items/item_spawn.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b8em61mqgdi58
|
||||
14
items/item_spawn.tscn
Normal file
14
items/item_spawn.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://xj0of571aur1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b8em61mqgdi58" path="res://items/item_spawn.gd" id="1_ms6tn"]
|
||||
[ext_resource type="PackedScene" uid="uid://b00185vygcka1" path="res://items/heal_item.tscn" id="2_w6i8k"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_5pwuf"]
|
||||
|
||||
[node name="ItemSpawn" type="Node2D"]
|
||||
script = ExtResource("1_ms6tn")
|
||||
common_items = Array[PackedScene]([ExtResource("2_w6i8k")])
|
||||
rare_items = Array[PackedScene]([ExtResource("2_w6i8k")])
|
||||
unique_items = Array[PackedScene]([ExtResource("2_w6i8k")])
|
||||
metadata/_custom_type_script = "uid://b8em61mqgdi58"
|
||||
|
||||
[node name="EarthAligner" parent="." instance=ExtResource("3_5pwuf")]
|
||||
|
|
@ -6,8 +6,12 @@ var angle = 0
|
|||
|
||||
func _ready() -> void:
|
||||
parent = get_parent()
|
||||
align()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
align()
|
||||
|
||||
func align():
|
||||
angle = -(parent.position - center).angle_to(Vector2.UP)
|
||||
parent.rotation = angle;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://chs0u61f45nau"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ciehyjlxjvrvb" path="res://earth_aligner.gd" id="1_sx2xq"]
|
||||
[ext_resource type="Script" uid="uid://ciehyjlxjvrvb" path="res://utils/earth_aligner.gd" id="1_sx2xq"]
|
||||
|
||||
[node name="EarthAligner" type="Node2D"]
|
||||
script = ExtResource("1_sx2xq")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue