Skip to content

Commit

Permalink
Merge pull request #4036 from KBVE/patch-atomic-adding-a-bit-of-rando…
Browse files Browse the repository at this point in the history
…m-to-the-drops-02-20-2025-1740092776

[CI] Merge patch-atomic-adding-a-bit-of-random-to-the-drops-02-20-2025-1740092776 into dev
  • Loading branch information
h0lybyte authored Feb 20, 2025
2 parents 62641d0 + 7e5cea0 commit 639f42b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions apps/gamejam/brackeys/13/scenes/ui/shop.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://cl2srbe0xb2gw"]

[ext_resource type="Script" path="res://scripts/shop.gd" id="1_xq0us"]

[node name="Shop" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_xq0us")
5 changes: 5 additions & 0 deletions apps/gamejam/brackeys/13/scripts/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ var starship_data := {
"shield_active": false
}

func earn_random_resource(resource_name: String, min_value: int = 3, max_value: int = 15):
var amount = randi_range(min_value, max_value)
earn_resource(resource_name, amount)


func earn_resource(resource_name: String, amount: int, invoice: String = "Earned"):
if amount <= 0:
return
Expand Down
2 changes: 1 addition & 1 deletion apps/gamejam/brackeys/13/scripts/laser.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func _on_area_entered(area):
var asteroid = area
asteroid.destroy()
Global.emit_signal("notification_received", "asteroid_hit", "Asteroid was destoried!", "success")
Global.earn_resource("stone", 10)
Global.earn_random_resource("stone")
visible = false
if get_parent():
get_parent()._on_laser_exited(self)
11 changes: 11 additions & 0 deletions apps/gamejam/brackeys/13/scripts/shop.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends Control


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

0 comments on commit 639f42b

Please sign in to comment.