From f00b24274dbc994c03b9ee6506809ff23c2518c9 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Tue, 15 Nov 2022 18:18:01 +0100 Subject: [PATCH] new file naming --- project.godot | 2 +- scenes/Main.tscn | 15 ---------- scenes/Player.tscn | 2 +- scenes/maps/main.tscn | 16 ++++++++++ .../{World.tscn => maps/tilemaps/world.tscn} | 2 +- src/Main.cs | 2 +- src/Player.cs | 2 +- src/TilemapForeground.cs | 30 ------------------- src/tilemap_foreground.cs | 29 ++++++++++++++++++ 9 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 scenes/Main.tscn create mode 100644 scenes/maps/main.tscn rename scenes/{World.tscn => maps/tilemaps/world.tscn} (98%) delete mode 100644 src/TilemapForeground.cs create mode 100644 src/tilemap_foreground.cs diff --git a/project.godot b/project.godot index da7f161..571297c 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=4 [application] config/name="RPG-Test" -run/main_scene="res://scenes/Main.tscn" +run/main_scene="res://scenes/maps/main.tscn" boot_splash/show_image=false boot_splash/bg_color=Color( 0.141176, 0.141176, 0.141176, 1 ) config/icon="res://icon.png" diff --git a/scenes/Main.tscn b/scenes/Main.tscn deleted file mode 100644 index 36874f5..0000000 --- a/scenes/Main.tscn +++ /dev/null @@ -1,15 +0,0 @@ -[gd_scene load_steps=4 format=2] - -[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=1] -[ext_resource path="res://scenes/World.tscn" type="PackedScene" id=2] -[ext_resource path="res://src/Main.cs" type="Script" id=3] - -[node name="Main" type="Node2D"] -position = Vector2( 4, 0 ) -scale = Vector2( 1, 1.00619 ) -script = ExtResource( 3 ) - -[node name="World" parent="." instance=ExtResource( 2 )] - -[node name="Player" parent="." instance=ExtResource( 1 )] -speed = 600 diff --git a/scenes/Player.tscn b/scenes/Player.tscn index 5c510cd..d0ec23e 100644 --- a/scenes/Player.tscn +++ b/scenes/Player.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://assets/textures/cupcake.png" type="Texture" id=1] -[ext_resource path="res://src/Player.cs" type="Script" id=2] +[ext_resource path="res://src/player.cs" type="Script" id=2] [sub_resource type="SpriteFrames" id=1] animations = [ { diff --git a/scenes/maps/main.tscn b/scenes/maps/main.tscn new file mode 100644 index 0000000..d9e02e7 --- /dev/null +++ b/scenes/maps/main.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://scenes/maps/tilemaps/world.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/main.cs" type="Script" id=3] + +[node name="Main" type="Node2D"] +position = Vector2( 4, 0 ) +scale = Vector2( 1, 1.00619 ) +script = ExtResource( 3 ) + +[node name="World" parent="." instance=ExtResource( 1 )] +tile_data = PoolIntArray( -196612, 0, 0, -196611, 0, 1, -196610, 0, 1, -196609, 0, 1, -262144, 0, 1, -262143, 0, 1, -262142, 0, 1, -262141, 0, 2, -131076, 0, 65536, -131075, 0, 65537, -131074, 0, 131073, -131073, 0, 131073, -196608, 0, 131073, -196607, 0, 131073, -196606, 0, 65537, -196605, 0, 65538, -65540, 0, 65536, -65539, 0, 65538, -131070, 0, 65536, -131069, 0, 65538, -4, 0, 65536, -3, 0, 65537, -2, 0, 1, -1, 0, 1, -65536, 0, 1, -65535, 0, 1, -65534, 0, 65537, -65533, 0, 65538, 65532, 0, 65536, 65533, 0, 65537, 65534, 0, 65537, 65535, 0, 65537, 0, 0, 65537, 1, 0, 65537, 2, 0, 65537, 3, 0, 65538, 131068, 0, 65536, 131069, 0, 65537, 131070, 0, 65537, 131071, 0, 65537, 65536, 0, 65537, 65537, 0, 65537, 65538, 0, 65537, 65539, 0, 65538, 196604, 0, 131072, 196605, 0, 131073, 196606, 0, 131073, 196607, 0, 131073, 131072, 0, 131073, 131073, 0, 131073, 131074, 0, 131073, 131075, 0, 131074 ) + +[node name="Player" parent="." instance=ExtResource( 2 )] +speed = 600 diff --git a/scenes/World.tscn b/scenes/maps/tilemaps/world.tscn similarity index 98% rename from scenes/World.tscn rename to scenes/maps/tilemaps/world.tscn index ef8b85d..32cdf34 100644 --- a/scenes/World.tscn +++ b/scenes/maps/tilemaps/world.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://tilesets/Background.tres" type="TileSet" id=1] [ext_resource path="res://tilesets/foreground_test.tres" type="TileSet" id=2] -[ext_resource path="res://src/TilemapForeground.cs" type="Script" id=3] +[ext_resource path="res://src/tilemap_foreground.cs" type="Script" id=3] [node name="World" type="TileMap"] tile_set = ExtResource( 1 ) diff --git a/src/Main.cs b/src/Main.cs index 499e2b2..ae51455 100644 --- a/src/Main.cs +++ b/src/Main.cs @@ -1,7 +1,7 @@ using Godot; using System; -public class Main : Node2D +public class main : Node2D { public override void _Ready() diff --git a/src/Player.cs b/src/Player.cs index 5528c6b..eb071c8 100644 --- a/src/Player.cs +++ b/src/Player.cs @@ -1,7 +1,7 @@ using Godot; using System; -public class Player : KinematicBody2D +public class player : KinematicBody2D { [Export] public int speed = 400; diff --git a/src/TilemapForeground.cs b/src/TilemapForeground.cs deleted file mode 100644 index 1b44f94..0000000 --- a/src/TilemapForeground.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Godot; -using System; -using System.Linq; - -public class TilemapForeground : TileMap -{ - [Export] - bool ReplaceStaticTilesWithNodes = true; - public override void _Process(float delta) - { - - } - - public override void _Ready() - { - if (ReplaceStaticTilesWithNodes) - { - ReplaceStaticTiles(1); - } - } - - public void ReplaceStaticTiles(int CellID) - { - Vector2[] allcells = GetUsedCellsById(CellID).OfType().ToArray(); - for(int i = 0; i < allcells.Length; i++) - { - GD.Print(allcells[i]); //now you can get the coordination to spawn a replacement node and get x and y seperately for removing this tile - } - } -} diff --git a/src/tilemap_foreground.cs b/src/tilemap_foreground.cs new file mode 100644 index 0000000..c762468 --- /dev/null +++ b/src/tilemap_foreground.cs @@ -0,0 +1,29 @@ +using Godot; +using System; + +public class tilemap_foreground : TileMap +{ + [Export] + bool ReplaceStaticTilesWithNodes = true; + public override void _Process(float delta) + { + + } + + public override void _Ready() + { + if (ReplaceStaticTilesWithNodes) + { + ReplaceStaticTiles(1); + } + } + + public void ReplaceStaticTiles(int CellID) + { + //Vector2[] AllCells = GetUsedCellsById(CellID); //why isnt it just a normal array wtf + // for(int i = 0; i == AllCells.Length; i++) + // { + // GD.Print(AllCells[i]); + // } + } +}