new file naming
This commit is contained in:
@@ -11,7 +11,7 @@ config_version=4
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="RPG-Test"
|
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/show_image=false
|
||||||
boot_splash/bg_color=Color( 0.141176, 0.141176, 0.141176, 1 )
|
boot_splash/bg_color=Color( 0.141176, 0.141176, 0.141176, 1 )
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
@@ -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
|
|
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/textures/cupcake.png" type="Texture" id=1]
|
[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]
|
[sub_resource type="SpriteFrames" id=1]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
|
16
scenes/maps/main.tscn
Normal file
16
scenes/maps/main.tscn
Normal file
@@ -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
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource path="res://tilesets/Background.tres" type="TileSet" id=1]
|
[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://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"]
|
[node name="World" type="TileMap"]
|
||||||
tile_set = ExtResource( 1 )
|
tile_set = ExtResource( 1 )
|
@@ -1,7 +1,7 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class Main : Node2D
|
public class main : Node2D
|
||||||
{
|
{
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class Player : KinematicBody2D
|
public class player : KinematicBody2D
|
||||||
{
|
{
|
||||||
[Export]
|
[Export]
|
||||||
public int speed = 400;
|
public int speed = 400;
|
||||||
|
@@ -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<Vector2>().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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
29
src/tilemap_foreground.cs
Normal file
29
src/tilemap_foreground.cs
Normal file
@@ -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]);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user