1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-25 09:14:18 +00:00

😌 Add peashooter model and sound

This commit is contained in:
Ichicoro 2023-01-08 16:44:18 +01:00
parent 7051a1a311
commit 12b5cdd1b9
12 changed files with 293 additions and 22 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,30 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bjjjpgtdtub3r"
path="res://.godot/imported/peashooter.gltf-a182ee289dc84227ab48ac07f111ea1f.scn"
[deps]
source_file="res://assets/peashooter/peashooter.gltf"
dest_files=["res://.godot/imported/peashooter.gltf-a182ee289dc84227ab48ac07f111ea1f.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
import_script/path=""
_subresources={}

Binary file not shown.

BIN
assets/peashooter/peashooter.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bp07vx515hkr2"
path="res://.godot/imported/peashooter.wav-1170454933d0e8d6f36d861ef2a6880f.sample"
[deps]
source_file="res://assets/peashooter/peashooter.wav"
dest_files=["res://.godot/imported/peashooter.wav-1170454933d0e8d6f36d861ef2a6880f.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -6,10 +6,10 @@
[ext_resource type="AudioStream" uid="uid://lkftwgdun745" path="res://assets/pop.wav" id="3_gur2a"] [ext_resource type="AudioStream" uid="uid://lkftwgdun745" path="res://assets/pop.wav" id="3_gur2a"]
[ext_resource type="Script" path="res://island/Pop.gd" id="4_5e7wk"] [ext_resource type="Script" path="res://island/Pop.gd" id="4_5e7wk"]
[sub_resource type="BoxShape3D" id="BoxShape3D_rkrm1"] [sub_resource type="BoxShape3D" id="BoxShape3D_uv07x"]
size = Vector3(1, 0.1, 1) size = Vector3(1, 0.1, 1)
[sub_resource type="ArrayMesh" id="ArrayMesh_t1otr"] [sub_resource type="ArrayMesh" id="ArrayMesh_fdp43"]
_surfaces = [{ _surfaces = [{
"aabb": AABB(-0.5, 0, -0.5, 1.00001, 1.00001, 1), "aabb": AABB(-0.5, 0, -0.5, 1.00001, 1.00001, 1),
"attribute_data": PackedByteArray(143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 31, 133, 107, 63, 183, 109, 91, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63), "attribute_data": PackedByteArray(143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 31, 133, 107, 63, 183, 109, 91, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63),
@ -37,11 +37,11 @@ collision_mask = 0
[node name="PlantableArea" type="CollisionShape3D" parent="Plant"] [node name="PlantableArea" type="CollisionShape3D" parent="Plant"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
shape = SubResource("BoxShape3D_rkrm1") shape = SubResource("BoxShape3D_uv07x")
[node name="Sprout" type="MeshInstance3D" parent="Plant"] [node name="Sprout" type="MeshInstance3D" parent="Plant"]
transform = Transform3D(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) transform = Transform3D(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
mesh = SubResource("ArrayMesh_t1otr") mesh = SubResource("ArrayMesh_fdp43")
skeleton = NodePath("../../..") skeleton = NodePath("../../..")
[node name="GrowthTimer" type="Timer" parent="."] [node name="GrowthTimer" type="Timer" parent="."]

View file

@ -5,15 +5,15 @@
[ext_resource type="AudioStream" uid="uid://lkftwgdun745" path="res://assets/pop.wav" id="3_b3ttd"] [ext_resource type="AudioStream" uid="uid://lkftwgdun745" path="res://assets/pop.wav" id="3_b3ttd"]
[ext_resource type="Script" path="res://island/Pop.gd" id="4_rn5e2"] [ext_resource type="Script" path="res://island/Pop.gd" id="4_rn5e2"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_3af3s"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_l6rok"]
height = 0.9 height = 0.9
radius = 0.3 radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_77mmo"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_qf6hb"]
height = 6.0 height = 6.0
radius = 3.0 radius = 3.0
[sub_resource type="CylinderShape3D" id="CylinderShape3D_x36gm"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_w04xf"]
height = 1.4 height = 1.4
radius = 0.7 radius = 0.7
@ -25,7 +25,7 @@ linear_damp = 1.0
[node name="Shape" type="CollisionShape3D" parent="."] [node name="Shape" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45, 0)
shape = SubResource("CylinderShape3D_3af3s") shape = SubResource("CylinderShape3D_l6rok")
[node name="PineappleMesh" parent="." instance=ExtResource("1_ndmmp")] [node name="PineappleMesh" parent="." instance=ExtResource("1_ndmmp")]
@ -46,7 +46,7 @@ monitorable = false
[node name="Shape" type="CollisionShape3D" parent="MoveTowardsPlayer/MagnetArea"] [node name="Shape" type="CollisionShape3D" parent="MoveTowardsPlayer/MagnetArea"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
shape = SubResource("CylinderShape3D_77mmo") shape = SubResource("CylinderShape3D_qf6hb")
[node name="CaptureArea" type="Area3D" parent="MoveTowardsPlayer"] [node name="CaptureArea" type="Area3D" parent="MoveTowardsPlayer"]
collision_layer = 0 collision_layer = 0
@ -55,7 +55,7 @@ monitorable = false
[node name="Shape" type="CollisionShape3D" parent="MoveTowardsPlayer/CaptureArea"] [node name="Shape" type="CollisionShape3D" parent="MoveTowardsPlayer/CaptureArea"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
shape = SubResource("CylinderShape3D_x36gm") shape = SubResource("CylinderShape3D_w04xf")
[connection signal="body_entered" from="MoveTowardsPlayer/MagnetArea" to="MoveTowardsPlayer" method="_on_magnet_area_body_entered"] [connection signal="body_entered" from="MoveTowardsPlayer/MagnetArea" to="MoveTowardsPlayer" method="_on_magnet_area_body_entered"]
[connection signal="body_entered" from="MoveTowardsPlayer/CaptureArea" to="MoveTowardsPlayer" method="_on_capture_area_body_entered"] [connection signal="body_entered" from="MoveTowardsPlayer/CaptureArea" to="MoveTowardsPlayer" method="_on_capture_area_body_entered"]

View file

@ -13,6 +13,7 @@ const AIR_ACCELERATE = 100 # Hu/39.97
@onready var head: Node3D = $Head @onready var head: Node3D = $Head
@onready var camera: Camera3D = head.get_node("Viewport/CameraViewportContainer/GameViewport/Camera") @onready var camera: Camera3D = head.get_node("Viewport/CameraViewportContainer/GameViewport/Camera")
@onready var vport: SubViewport = head.get_node("Viewport/CameraViewportContainer/GameViewport") @onready var vport: SubViewport = head.get_node("Viewport/CameraViewportContainer/GameViewport")
@onready var gun_vport: SubViewport = $HUD/SubViewportContainer/SubViewport
@onready var aim_raycast: RayCast3D = head.get_node("RayCast3D") @onready var aim_raycast: RayCast3D = head.get_node("RayCast3D")
@onready var OnHand = head.get_node("OnHand") @onready var OnHand = head.get_node("OnHand")
@ -44,6 +45,7 @@ func _ready():
OnHand.player = self OnHand.player = self
Singletons.player = self Singletons.player = self
vport.size = viewport_resolution vport.size = viewport_resolution
gun_vport.size = viewport_resolution
func _physics_process(delta): func _physics_process(delta):
last_frame_input_data = input_data last_frame_input_data = input_data
@ -86,12 +88,10 @@ func _physics_process(delta):
# Apply camera effects # Apply camera effects
var camera_yaw := 0 var camera_yaw := 0
var current_speed := _get_2d_velocity().length() var current_speed := _get_2d_velocity().length()
if is_on_floor() and current_speed > 0: # if is_on_floor() and current_speed > 0:
camera_yaw = -clamp(_get_2d_velocity().length() * input_dir.x, -25, 25) # camera_yaw = -clamp(_get_2d_velocity().length() * input_dir.x, -25, 25)
else: # else:
camera_yaw = 0 # camera_yaw = 0
self.camera.global_transform = self.head.global_transform
# camera.rotation.z = move_toward( # camera.rotation.z = move_toward(
# 0, # 0,
@ -131,6 +131,10 @@ func _air_accelerate(wish_dir: Vector3, wish_speed: float, airaccelerate: float,
velocity += accelspeed * wish_dir velocity += accelspeed * wish_dir
func _process(delta: float) -> void:
self.camera.global_transform = self.head.global_transform
func wall_running() -> bool: func wall_running() -> bool:
if is_on_wall_only(): if is_on_wall_only():
if Input.is_action_pressed("jump"): if Input.is_action_pressed("jump"):

View file

@ -77,7 +77,7 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _physics_process(delta):
if not MainCamera: if not MainCamera:
return return
@ -213,7 +213,6 @@ copy_mode = 2
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="SubViewportContainer" type="SubViewportContainer" parent="HUD"] [node name="SubViewportContainer" type="SubViewportContainer" parent="HUD"]
visible = false
show_behind_parent = true show_behind_parent = true
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -226,11 +225,12 @@ stretch = true
transparent_bg = true transparent_bg = true
handle_input_locally = false handle_input_locally = false
size = Vector2i(284, 160) size = Vector2i(284, 160)
render_target_update_mode = 0 render_target_update_mode = 4
[node name="WeaponCamera" type="Camera3D" parent="HUD/SubViewportContainer/SubViewport" node_paths=PackedStringArray("MainCamera")] [node name="WeaponCamera" type="Camera3D" parent="HUD/SubViewportContainer/SubViewport" node_paths=PackedStringArray("MainCamera")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.581502, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.581502, 0)
cull_mask = 2 visible = false
cull_mask = 4
near = 0.001 near = 0.001
script = SubResource("GDScript_7qy62") script = SubResource("GDScript_7qy62")
MainCamera = NodePath("../../../../Head/Viewport/CameraViewportContainer/GameViewport/Camera") MainCamera = NodePath("../../../../Head/Viewport/CameraViewportContainer/GameViewport/Camera")

View file

@ -6,6 +6,7 @@ var last_fired := 0
var remaining := 10 var remaining := 10
@onready var ray = $RayCast3D @onready var ray = $RayCast3D
@onready var audio_player := $AudioStreamPlayer3D
# FIXME: use singleton class here as well # FIXME: use singleton class here as well
@onready var croptiles_container: Node3D = get_tree().root.find_child("CropTiles", true, false) @onready var croptiles_container: Node3D = get_tree().root.find_child("CropTiles", true, false)
var croptile = preload("res://island/CropTile.tscn") var croptile = preload("res://island/CropTile.tscn")
@ -32,7 +33,7 @@ func _process(_delta: float) -> void:
func shoot() -> void: func shoot() -> void:
last_fired = Time.get_ticks_msec() last_fired = Time.get_ticks_msec()
# audio_player.play() audio_player.play()
# $AnimationPlayer.seek(0) # $AnimationPlayer.seek(0)
# $AnimationPlayer.play("shoot") # $AnimationPlayer.play("shoot")

View file

@ -1,6 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://cu53ekfgwammu"] [gd_scene load_steps=5 format=3 uid="uid://cu53ekfgwammu"]
[ext_resource type="Script" path="res://player/onhand/PeaShooter.gd" id="1_bl35a"] [ext_resource type="Script" path="res://player/onhand/PeaShooter.gd" id="1_bl35a"]
[ext_resource type="PackedScene" uid="uid://bjjjpgtdtub3r" path="res://assets/peashooter/peashooter.gltf" id="2_131r2"]
[ext_resource type="PackedScene" uid="uid://bcl83sr2mgwaf" path="res://player/onhand/peashooter_model.tscn" id="2_ra8vl"]
[ext_resource type="AudioStream" uid="uid://bp07vx515hkr2" path="res://assets/peashooter/peashooter.wav" id="4_uhlty"]
[node name="PeaShooter" type="Node3D"] [node name="PeaShooter" type="Node3D"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0) transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
@ -10,3 +13,14 @@ script = ExtResource("1_bl35a")
target_position = Vector3(1000, 0, 0) target_position = Vector3(1000, 0, 0)
collision_mask = 24 collision_mask = 24
collide_with_areas = true collide_with_areas = true
[node name="peashooter2" parent="." instance=ExtResource("2_ra8vl")]
transform = Transform3D(-0.5, 0, -7.54979e-08, 0, 0.5, 0, 7.54979e-08, 0, -0.5, 0.6, -0.8, 0.5)
[node name="peashooter" parent="." instance=ExtResource("2_131r2")]
transform = Transform3D(-0.5, 0, -7.54979e-08, 0, 0.5, 0, 7.54979e-08, 0, -0.5, 0.6, -0.8, 0.5)
visible = false
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("4_uhlty")
volume_db = -7.517

View file

@ -0,0 +1,27 @@
[gd_scene load_steps=3 format=3 uid="uid://bcl83sr2mgwaf"]
[ext_resource type="PackedScene" uid="uid://bjjjpgtdtub3r" path="res://assets/peashooter/peashooter.gltf" id="1_qt7i2"]
[sub_resource type="GDScript" id="GDScript_mxvns"]
script/source = "extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var mesh = self.get_child(0) as MeshInstance3D
var mat = mesh.get_active_material(0) as BaseMaterial3D
mat.texture_filter = BaseMaterial3D.TEXTURE_FILTER_NEAREST
# mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
mat.ao_enabled = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
"
[node name="peashooter" instance=ExtResource("1_qt7i2")]
script = SubResource("GDScript_mxvns")
[node name="Untitled" parent="." index="0"]
gi_mode = 2