Skip to content

Commit

Permalink
lospec#15 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
theaino committed Nov 19, 2024
1 parent b85802a commit ca55f67
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
13 changes: 8 additions & 5 deletions fish.gd
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func _process(delta):
SWIM: swim,
FOOD: food
}[state].call()

hunger = hunger + delta * hungerSpeed
if (hunger > hungerThreshold): hunger = hungerThreshold

Expand All @@ -76,6 +76,9 @@ func _process(delta):
sprite.scale.x = 1
mouth.scale.x = 1

func is_hungry():
return hunger > hungerThreshold / 2

func idle():
boredom = boredom + rng.randi_range(0,5)
if (boredom > boredomThreshold):
Expand All @@ -84,13 +87,13 @@ func idle():
updateOutline()

func swim():
if (hunger>hungerThreshold/2 && FoodGroup.get_children().size() > 0):
if (is_hungry() && FoodGroup.get_children().size() > 0):
state = FOOD
return food()

if (tired == 0):
direction = Vector2(rng.randi_range(-1,1), rng.randi_range(-1,1))
if (hunger > hungerThreshold/2): speed = maxSpeed / 5
if (is_hungry()): speed = maxSpeed / 5
else: speed = maxSpeed

apply_impulse(Vector2(direction.x/100*speed,direction.y/500*speed), Vector2(0.5,0.5))
Expand All @@ -99,7 +102,7 @@ func swim():
if (tired > tiredThreshold):
state = IDLE
tired = 0
if (hunger > hungerThreshold/2): tired = tiredThreshold/2
if (is_hungry()): tired = tiredThreshold/2

moneyDrop()

Expand All @@ -115,7 +118,7 @@ func moneyDrop():

func food():
var current_foods = FoodGroup.get_children()
if current_foods.size() == 0:
if current_foods.size() == 0 || !is_hungry():
state = SWIM
return swim()
var closest_distance = 9999
Expand Down
6 changes: 3 additions & 3 deletions main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ Label/fonts/font = ExtResource("16_txocg")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4ss04"]
size = Vector2(96, 57)

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1ihl1"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gf4ul"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_akpou"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1ihl1"]

[node name="Node2D" type="Node2D"]
script = ExtResource("1_rauu0")
metadata/_edit_vertical_guides_ = [-82.0, 560.0, -76.0, -12.0]
Expand Down Expand Up @@ -510,9 +510,9 @@ theme = ExtResource("8_pmiyt")
theme_override_colors/font_color = Color(0.286275, 0.333333, 0.533333, 1)
theme_override_fonts/font = ExtResource("15_fg7uf")
theme_override_font_sizes/font_size = 8
theme_override_styles/normal = SubResource("StyleBoxEmpty_1ihl1")
theme_override_styles/focus = SubResource("StyleBoxEmpty_gf4ul")
theme_override_styles/read_only = SubResource("StyleBoxEmpty_akpou")
theme_override_styles/normal = SubResource("StyleBoxEmpty_1ihl1")
text = "FISH NAME"
alignment = 1
max_length = 10
Expand Down
4 changes: 2 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config/name="Lospequarium"
config/version="6"
config/tags=PackedStringArray("lospec_collab", "real_game")
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/features=PackedStringArray("4.3", "GL Compatibility")
config/icon="res://art/icons/icon.png"

[display]
Expand Down Expand Up @@ -47,7 +47,7 @@ folder_colors={

ChangeFish={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

Expand Down
3 changes: 0 additions & 3 deletions shop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,3 @@ func checkIfClickedShopButtonIsDisable (event, button):
if (event is InputEventMouseButton && event.pressed && event.button_index==1):
if (button.disabled):
get_node("/root/Node2D/Sound/CantBuy").playing = true



0 comments on commit ca55f67

Please sign in to comment.