Skip to content

Commit

Permalink
Merge pull request #83 from astro-panda/psypher9/something
Browse files Browse the repository at this point in the history
Fixed trash platform scene
  • Loading branch information
Psypher9 authored Oct 4, 2022
2 parents 96d5398 + 16753d7 commit 5db4f40
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
6 changes: 3 additions & 3 deletions FloppyFish/Audio/default_bus_layout.tres
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bus/3/name = "Fish"
bus/3/solo = false
bus/3/mute = false
bus/3/bypass_fx = false
bus/3/volume_db = 3.64024
bus/3/volume_db = 1.45823
bus/3/send = "Foley"
bus/3/effect/0/effect = SubResource( 1 )
bus/3/effect/0/enabled = true
Expand All @@ -41,11 +41,11 @@ bus/6/name = "Background Scenery"
bus/6/solo = false
bus/6/mute = false
bus/6/bypass_fx = false
bus/6/volume_db = 0.464998
bus/6/volume_db = 5.62226
bus/6/send = "Background"
bus/7/name = "BackgMusic"
bus/7/solo = false
bus/7/mute = false
bus/7/bypass_fx = false
bus/7/volume_db = -11.952
bus/7/volume_db = -6.91795
bus/7/send = "Background"
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/trashplatform.png-5b99e2ffe19d195f16d17fd6d0488e3e.stex"
path="res://.import/definitelynotatrashplatform.png-9a33f819655d4a58df859555524b4ac5.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Images/Pixelart/trashplatform.png"
dest_files=[ "res://.import/trashplatform.png-5b99e2ffe19d195f16d17fd6d0488e3e.stex" ]
source_file="res://Images/Pixelart/definitelynotatrashplatform.png"
dest_files=[ "res://.import/definitelynotatrashplatform.png-9a33f819655d4a58df859555524b4ac5.stex" ]

[params]

Expand Down
6 changes: 3 additions & 3 deletions FloppyFish/Scenes/Main.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[gd_scene load_steps=24 format=2]

[ext_resource path="res://Scenes/Fish.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/Platform.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/Platform2.tscn" type="PackedScene" id=2]
[ext_resource path="res://Images/Pixelart/water.png" type="Texture" id=3]
[ext_resource path="res://Scripts/Main.cs" type="Script" id=4]
[ext_resource path="res://Scenes/HUD.tscn" type="PackedScene" id=5]
[ext_resource path="res://Scenes/Platform2.tscn" type="PackedScene" id=6]
[ext_resource path="res://Scenes/Platform.tscn" type="PackedScene" id=6]
[ext_resource path="res://Scenes/Audio Controller.tscn" type="PackedScene" id=7]
[ext_resource path="res://Scenes/OctopusMech.tscn" type="PackedScene" id=8]
[ext_resource path="res://Images/Pixelart/backdrop.png" type="Texture" id=9]
Expand Down Expand Up @@ -91,7 +91,7 @@ script = ExtResource( 4 )
__meta__ = {
"_editor_description_": "Its the Main Scene. What of it."
}
PlatformScenes = [ ExtResource( 2 ), ExtResource( 6 ) ]
PlatformScenes = [ ExtResource( 6 ), ExtResource( 2 ) ]

[node name="HUD" parent="." instance=ExtResource( 5 )]

Expand Down
6 changes: 4 additions & 2 deletions FloppyFish/Scenes/Platform.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]

[ext_resource path="res://Scenes/Collectable.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Platform.cs" type="Script" id=2]
[ext_resource path="res://Images/Pixelart/trashplatform.png" type="Texture" id=3]
[ext_resource path="res://Images/Pixelart/definitelynotatrashplatform.png" type="Texture" id=3]

[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
Expand All @@ -23,6 +24,7 @@ collision_layer = 3
collision_mask = 3
gravity_scale = 0.0
script = ExtResource( 2 )
CollectibleScene = ExtResource( 1 )
Damping = -0.5
PullForce = 1.0

Expand Down
6 changes: 4 additions & 2 deletions FloppyFish/Scenes/Platform2.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://Scenes/Collectable.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Platform.cs" type="Script" id=2]
[ext_resource path="res://Images/Pixelart/trashplatform.png" type="Texture" id=3]
[ext_resource path="res://Images/Pixelart/definitelynotatrashplatform.png" type="Texture" id=3]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 180, 21 )
Expand All @@ -25,6 +26,7 @@ animations = [ {
collision_layer = 3
collision_mask = 3
script = ExtResource( 2 )
CollectibleScene = ExtResource( 1 )
Damping = -0.5
PullForce = 1.0

Expand Down
2 changes: 1 addition & 1 deletion FloppyFish/Scripts/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class Main : Node
{
[Export]
public List<PackedScene> PlatformScenes;
public List<PackedScene> PlatformScenes { get; set; } = new List<PackedScene>();

[Export]
public float PlatformSpawnInterval = 10;
Expand Down
8 changes: 4 additions & 4 deletions FloppyFish/Scripts/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ public class Platform : RigidBody2D
[Export]
public float Speed = 80f;

[Export]
public PackedScene CollectibleScene { get; set; }

public Vector2 WaterFlow = new Vector2((float)-0.946, (float)-0.326);

private Vector2 _targetPos = Vector2.Zero;
private PathFollow2D _followPos;

private Position2D _collectibleSpawn;

private PackedScene _collectibleScene;

// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_collectibleSpawn = GetNode<Position2D>("CollectibleSpawn");
_collectibleScene = GD.Load<PackedScene>("res://Scenes/Collectable.tscn");
}

// Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down Expand Up @@ -73,7 +73,7 @@ public void Spawn(PathFollow2D followPos, bool canSpawnCollectable)

if (canSpawnCollectable)
{
Collectable collectable = _collectibleScene.InstanceOrNull<Collectable>();
Collectable collectable = CollectibleScene.InstanceOrNull<Collectable>();

if (collectable != null)
{
Expand Down

0 comments on commit 5db4f40

Please sign in to comment.