1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-21 15:34:17 +00:00

more stuff

This commit is contained in:
Steffo 2023-01-14 22:27:13 +01:00
parent d6e086567d
commit 04ee1a95d4
Signed by: steffo
GPG key ID: 2A24051445686895
10 changed files with 83 additions and 27 deletions

View file

@ -49,4 +49,4 @@ static func delete_children(node):
static func log_line(obj: Node, msg: String):
var time = Time.get_time_dict_from_system()
var time_str = "%02d:%02d:%02d" % [time.hour, time.minute, time.second]
print("@%s [%s]: %s" % [time_str, obj.name, msg])

View file

@ -30,7 +30,7 @@ var current_scene: Node = null:
func move_to_island():
print("Starting game...")
emit_signal("moving_to_island")
current_scene = load("res://island/Island.tscn").instantiate()
current_scene = preload("res://island/Island.tscn").instantiate()
emit_signal("moved_to_island")
## Change the current scene to the main menu.
@ -38,7 +38,7 @@ func move_to_menu():
print("Going to the menu...")
emit_signal("moving_to_menu")
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
current_scene = load("res://menu/Menu.tscn").instantiate()
current_scene = preload("res://menu/Menu.tscn").instantiate()
current_scene.connect("play_pressed", move_to_island)
emit_signal("moved_to_menu")

View file

@ -37,9 +37,6 @@ sky = SubResource("Sky_j6hso")
[node name="Island" type="Node3D"]
[node name="Player" parent="." instance=ExtResource("3_5378m")]
transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 2.08165e-12, 3.896, 2.08165e-12)
[node name="Sea" parent="." instance=ExtResource("1_e0hpm")]
metadata/_edit_lock_ = true
@ -47,6 +44,9 @@ metadata/_edit_lock_ = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 20, 0, -4)
metadata/_edit_lock_ = true
[node name="Player" parent="." instance=ExtResource("3_5378m")]
transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 2.08165e-12, 3.896, 2.08165e-12)
[node name="World" type="Node3D" parent="."]
[node name="Environment" type="WorldEnvironment" parent="World"]
@ -235,6 +235,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 3, 59)
[node name="Leafpile19" parent="CropTiles" instance=ExtResource("9_472aa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 3, 60)
[node name="Leafpile22" parent="CropTiles" instance=ExtResource("9_472aa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26, 1, 33)
[node name="Produce" type="Node3D" parent="."]
metadata/_edit_lock_ = true

View file

@ -1,5 +1,5 @@
extends Node3D
class_name Temple
var score: int = 0
var time: float = 0.0
@ -7,16 +7,16 @@ var is_exploded: bool = false
@export var size_per_prayer: float = 0.05
@export var pitch_per_prayer: float = 0.02
@export var explode_at: int = 1
@export var explode_at: int = 150
@export var explosion_scene: PackedScene = preload("res://island/FunnyExplosion.tscn")
@onready var player: Player = Singletons.player
@onready var prayer_area: Area3D = $PrayerArea
@onready var pineglasses: MeshInstance3D = $Pineglasses
@onready var pineglasses_sound: AudioStreamPlayer3D = $Pineglasses/Growth
func try_to_collect_fruit():
var player = Singletons.player
if prayer_area.overlaps_body(player):
if player.collected_fruit > 0:
if not pineglasses_sound.playing:

View file

@ -19,6 +19,5 @@ func _on_fetched_scores():
func _ready():
print("Connecting fetched_scores to the Scores button")
$"/root/BaseScene/ScoreboardContainer".connect("fetched_scores", _on_fetched_scores)
$"/root/BaseScene/ScoreboardContainer".fetch_scores(false)

View file

@ -66,7 +66,6 @@ func fetch_scores(open_after: bool = false):
func show_scores():
print("Displaying scores...")
prev_mouse_mode = Input.mouse_mode as Input.MouseMode
print("Previous mouse mode was: ", prev_mouse_mode)
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
visible = true

View file

@ -9,6 +9,7 @@ var noiseRot := Vector3.ZERO
var noiseCount := 0
@export var noiseAmp := 10.0
@export var noiseFreq := 100.0
@onready var camera = $Viewport/CameraViewportContainer/GameViewport/Camera
var mouseRot := Vector2.ZERO
@ -23,3 +24,7 @@ func _ready() -> void:
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
mouseRot = event.relative
func _physics_process(_delta):
camera.global_transform = global_transform

View file

@ -22,8 +22,12 @@ const AIR_ACCELERATE = 100 # Hu/39.97
@onready var active_weapon: BaseWeapon:
get: return OnHand.active_weapon
@onready var ammo_label = $HUD/AmmoLabel
@onready var fruit_label = $HUD/PineappleLabel
@onready var ammo_label: Label = $HUD/AmmoLabel
@onready var fruit_label: Label = $HUD/PineappleLabel
@onready var speed_label: Label = $HUD/SpeedLabel
@onready var timer_label: Label = $HUD/TimerLabel
@onready var temple: Temple = $"/root/BaseScene/Island/Temple"
var collected_fruit: int = 0:
get:
@ -96,7 +100,7 @@ func _physics_process(delta):
if active_weapon and active_weapon.ammoType != BaseWeapon.AmmoType.NONE:
ammo_label.show()
if active_weapon is PeaShooter:
ammo_label.text = "%d seeds left" % active_weapon.remaining
ammo_label.text = "%d seeds" % active_weapon.remaining
else:
ammo_label.hide()
@ -126,7 +130,11 @@ func _air_accelerate(wish_dir: Vector3, wish_speed: float, airaccelerate: float,
func _process(_delta: float) -> void:
self.camera.global_transform = self.head.global_transform
speed_label.text = "%0.2f km/h" % velocity.length()
if temple != null:
timer_label.text = "%0.3f s" % temple.time
else:
timer_label.text = ""
func _input(event):

View file

@ -147,17 +147,22 @@ scale = Vector2(1.65, 1)
metadata/_edit_lock_ = true
[node name="PineappleLabel" type="Label" parent="HUD"]
layout_mode = 0
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 8.0
offset_top = -26.0
offset_right = 106.0
offset_bottom = -8.0
offset_left = -102.0
offset_top = -22.0
offset_right = -4.0
offset_bottom = -4.0
grow_horizontal = 0
grow_vertical = 0
theme = ExtResource("4_d7ru6")
theme_override_font_sizes/font_size = 16
text = "0 harvested"
horizontal_alignment = 2
vertical_alignment = 2
[node name="AmmoLabel" type="Label" parent="HUD"]
@ -166,18 +171,48 @@ anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -103.0
offset_top = -26.0
offset_right = -8.0
offset_bottom = -8.0
offset_left = -99.0
offset_top = -34.0
offset_right = -4.0
offset_bottom = -16.0
grow_horizontal = 0
grow_vertical = 0
theme = ExtResource("4_d7ru6")
theme_override_font_sizes/font_size = 16
text = "8888 seeds left"
text = "8888 seeds"
horizontal_alignment = 2
vertical_alignment = 2
[node name="TimerLabel" type="Label" parent="HUD"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 4.0
offset_top = -34.0
offset_right = 99.0
offset_bottom = -16.0
grow_vertical = 0
theme = ExtResource("4_d7ru6")
theme_override_font_sizes/font_size = 16
text = "0.000 s"
vertical_alignment = 2
[node name="SpeedLabel" type="Label" parent="HUD"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 4.0
offset_top = -22.0
offset_right = 99.0
offset_bottom = -4.0
grow_vertical = 0
theme = ExtResource("4_d7ru6")
theme_override_font_sizes/font_size = 16
text = "5.00 km/h"
vertical_alignment = 2
[node name="Crosshair" type="ColorRect" parent="HUD"]
material = SubResource("ShaderMaterial_2p6rt")
layout_mode = 0

View file

@ -53,6 +53,11 @@ _global_script_classes=[{
"class": &"SinkArea",
"language": &"GDScript",
"path": "res://island/sinking/SinkArea.gd"
}, {
"base": "Node3D",
"class": &"Temple",
"language": &"GDScript",
"path": "res://island/Temple.gd"
}]
_global_script_class_icons={
"BaseScene": "",
@ -63,16 +68,18 @@ _global_script_class_icons={
"Player": "",
"PlayerInputData": "",
"ScoreBox": "",
"SinkArea": ""
"SinkArea": "",
"Temple": ""
}
[application]
config/name="Pineapple Surf"
config/description="A bunnyhopping, retro-looking, first person seed shooters"
config/description="A bunnyhopping, retro-looking, first person seed shooter"
run/main_scene="res://base/BaseScene.tscn"
config/features=PackedStringArray("4.0", "GL Compatibility")
boot_splash/bg_color=Color(0.231373, 0.490196, 0.309804, 1)
boot_splash/image="res://assets/pineglasses.png"
config/icon="res://assets/pineglasses.png"
[autoload]