-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 42df6c2
Showing
118 changed files
with
93,292 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="f992a46100220ca1148978becf8ffd19" | ||
dest_md5="ffc7e4ff827dec1ee28c759af4554b9c" | ||
|
Binary file added
BIN
+28.4 KB
.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.stex
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="47313fa4c47a9963fddd764e1ec6e4a8" | ||
dest_md5="2ded9e7f9060e2b530aab678b135fc5b" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_chop1.ogg-101a711e337424b027a92018d00ba6f5.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="ab00363c225e4ec8a2f31bd0f5f70ace" | ||
dest_md5="469fba5f4cafbeec5ae682d65078eb22" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_chop2.ogg-075f8abc8443715d640b742603dc42d5.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="9f49a4664c1ecc23ef3652e8200d352c" | ||
dest_md5="a2dd4d12f95d20c80c5dfed9998f0d90" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_die.ogg-c525b5c44e24766c2b8f2748839e4c29.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="57464395994948e6540b26760ec39a75" | ||
dest_md5="0f2618b38edb3ad74bfe0e41e8a2fdb3" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_enemy1.ogg-90c2b54c814fdf74d3f6510c38cc5a8b.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="22a422bcf0468fb7d3547caaf9332cd4" | ||
dest_md5="72dfc5ba37e6373dd4f3f18bcf72e567" | ||
|
Binary file added
BIN
+7.09 KB
.import/scavengers_enemy1.ogg-90c2b54c814fdf74d3f6510c38cc5a8b.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_enemy2.ogg-475454d479de76f7c1d703ceffa018c0.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="19e8c9704133435c8fd3152e58e3b778" | ||
dest_md5="eab71b12cb54e0162fc7d8f362a2766d" | ||
|
Binary file added
BIN
+11.4 KB
.import/scavengers_enemy2.ogg-475454d479de76f7c1d703ceffa018c0.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_footstep1.ogg-f550c0146a892007838f885281fd66f3.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="ca5a1fe65cb6229fb8213afd1b52092d" | ||
dest_md5="62eeafb74f9b318441575d2cfd5eb435" | ||
|
Binary file added
BIN
+11.2 KB
.import/scavengers_footstep1.ogg-f550c0146a892007838f885281fd66f3.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_footstep2.ogg-6b6027db77ebfccd3a8e1c3f38a33398.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="4af9f05940e058e6c387e1d358b966c5" | ||
dest_md5="0166b4b668555f1d3940ca0caa4e06f0" | ||
|
Binary file added
BIN
+11.4 KB
.import/scavengers_footstep2.ogg-6b6027db77ebfccd3a8e1c3f38a33398.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_fruit1.ogg-0a61d5fc85a8013d9c48157820e1bdd3.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="d724fda50098950d04ac2445e419e9a2" | ||
dest_md5="5961ec15093bcfe975d5b4c2e5d7d5cf" | ||
|
Binary file added
BIN
+9.61 KB
.import/scavengers_fruit1.ogg-0a61d5fc85a8013d9c48157820e1bdd3.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_fruit2.ogg-67a643fb9527e5e3a036e3b586fca172.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="813ede8c4c117f5c95945be9924454c7" | ||
dest_md5="61fa21f966f9aad7fcf20a878c49a26b" | ||
|
Binary file added
BIN
+7.73 KB
.import/scavengers_fruit2.ogg-67a643fb9527e5e3a036e3b586fca172.oggstr
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_music.wav-c87cac7d0166b281460cb329e271f752.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="7e458f4185b8902eb4f572d5fd2d532d" | ||
dest_md5="2094092fb028b04070741a1e2800ed80" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_soda1.ogg-629764a09efbfb7a70d4eea16fcc591d.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="c2205c981ec1b7d542c943e7ca170057" | ||
dest_md5="1d18ab2b1243689164144dc1d5b6296a" | ||
|
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
.import/scavengers_soda2.ogg-ae322ce00ae7133846e505a65507de89.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="a1e73f6417d6c1051386add97168acf4" | ||
dest_md5="f06a1f2caf8c64ba57cb3b2e2d12a186" | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[core] | ||
|
||
modified_time=1587297980 | ||
bindings_version=11 | ||
cs_glue_version=1587123907 | ||
api_hash=6518618335014185328 | ||
|
||
[editor] | ||
|
||
modified_time=1587297980 | ||
bindings_version=11 | ||
cs_glue_version=1587123907 | ||
api_hash=-5327691260921567658 |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[core] | ||
|
||
modified_time=1587314254 | ||
bindings_version=11 | ||
cs_glue_version=1587123907 | ||
api_hash=6518618335014185328 | ||
|
||
[editor] | ||
|
||
modified_time=1587314254 | ||
bindings_version=11 | ||
cs_glue_version=1587123907 | ||
api_hash=-5327691260921567658 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
38805 | ||
/home/ariel/programas instalados/Godot Engine/Godot Engine 3.2/godot 3.2.2 beta/Godot_v3.2.2-beta1_mono_x11_64/Godot_v3.2.2-beta1_mono_x11.64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"res://codigos/BoardManager.cs":{"modified_time":"1587380554","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1587392515","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1587385613","class":{"namespace":"","class_name":"GameManager","nested":false}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"res://codigos/BoardManager.cs":{"modified_time":"1587380554","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1587392515","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1587385613","class":{"namespace":"","class_name":"GameManager","nested":false}}} |
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
.mono/temp/obj/Debug/Rogue en Godot.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/home/ariel/Documentos/Godot engine proyectos/GODOT C# PROYECTOS/Rogue en Godot/.mono/temp/bin/Debug/Rogue en Godot.dll | ||
/home/ariel/Documentos/Godot engine proyectos/GODOT C# PROYECTOS/Rogue en Godot/.mono/temp/bin/Debug/Rogue en Godot.pdb | ||
/home/ariel/Documentos/Godot engine proyectos/GODOT C# PROYECTOS/Rogue en Godot/.mono/temp/obj/Debug/Rogue en Godot.csprojAssemblyReference.cache | ||
/home/ariel/Documentos/Godot engine proyectos/GODOT C# PROYECTOS/Rogue en Godot/.mono/temp/obj/Debug/Rogue en Godot.dll | ||
/home/ariel/Documentos/Godot engine proyectos/GODOT C# PROYECTOS/Rogue en Godot/.mono/temp/obj/Debug/Rogue en Godot.pdb |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
{ | ||
"name": "Attach", | ||
"type": "mono", | ||
"request": "attach", | ||
"address": "localhost", | ||
"port": 23685 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Reflection; | ||
|
||
// Information about this assembly is defined by the following attributes. | ||
// Change them to the values specific to your project. | ||
|
||
[assembly: AssemblyTitle("Rogue en Godot")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("")] | ||
[assembly: AssemblyCopyright("")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". | ||
// The form "{Major}.{Minor}.*" will automatically update the build and revision, | ||
// and "{Major}.{Minor}.{Build}.*" will update just the revision. | ||
|
||
[assembly: AssemblyVersion("1.0.*")] | ||
|
||
// The following attributes are used to specify the signing key for the assembly, | ||
// if desired. See the Mono documentation for more information about signing. | ||
|
||
//[assembly: AssemblyDelaySign(false)] | ||
//[assembly: AssemblyKeyFile("")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{2C1B9727-066C-416A-BD9B-C7E13732CB68}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<OutputPath>.mono/temp/bin/$(Configuration)</OutputPath> | ||
<RootNamespace>RogueenGodot</RootNamespace> | ||
<AssemblyName>Rogue en Godot</AssemblyName> | ||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> | ||
<GodotProjectGeneratorVersion>1.0.7412.22656</GodotProjectGeneratorVersion> | ||
<BaseIntermediateOutputPath>.mono/temp/obj</BaseIntermediateOutputPath> | ||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(Configuration)</IntermediateOutputPath> | ||
<ApiConfiguration Condition=" '$(Configuration)' != 'ExportRelease' ">Debug</ApiConfiguration> | ||
<ApiConfiguration Condition=" '$(Configuration)' == 'ExportRelease' ">Release</ApiConfiguration> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ExportDebug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>portable</DebugType> | ||
<Optimize>false</Optimize> | ||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ExportRelease|AnyCPU' "> | ||
<DebugType>portable</DebugType> | ||
<Optimize>true</Optimize> | ||
<DefineConstants>$(GodotDefineConstants);GODOT;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>portable</DebugType> | ||
<Optimize>false</Optimize> | ||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;TOOLS;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="GodotSharp"> | ||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="GodotSharpEditor" Condition=" '$(Configuration)' == 'Debug' "> | ||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="codigos\BoardManager.cs" /> | ||
<Compile Include="codigos\Escena_Principal.cs" /> | ||
<Compile Include="codigos\GameManager.cs" /> | ||
<Compile Include="codigos\MovingObject.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rogue en Godot", "Rogue en Godot.csproj", "{2C1B9727-066C-416A-BD9B-C7E13732CB68}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
ExportDebug|Any CPU = ExportDebug|Any CPU | ||
ExportRelease|Any CPU = ExportRelease|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU | ||
{2C1B9727-066C-416A-BD9B-C7E13732CB68}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
using Godot; | ||
using System; | ||
using System.Collections.Generic;//sino esta no funciona la lista | ||
|
||
public class BoardManager : Node2D | ||
{ | ||
//esto representa el area donde se puede mover el personaje | ||
[Export] | ||
public int columns = 8;//numero de columnas | ||
[Export] | ||
public int rows = 8;//numero de filas | ||
|
||
[Export] | ||
private Godot.Collections.Array<PackedScene> floorTiles,outerWallTiles,wallTiles,foodTiles,EnemyTiles;//suelos empaquetados para precargar desde el editor | ||
[Export] | ||
private PackedScene exit; | ||
private List<Vector2> gridPositions = new List<Vector2>();//esta lista guardara todas las posiciones para poder evitar que se superpongan algunos obstaculos y enemigos | ||
|
||
private Sprite toInstantiate;//referencia a los bloques del suelo que seran instanciados | ||
|
||
private Node2D board;//para poner todos los suelos instanciados | ||
|
||
public override void _Ready() | ||
{ | ||
board = (Node2D)GetTree().GetNodesInGroup("Board")[0];//busco el nodo en ese grupo | ||
GD.Randomize();//creo una semilla aleatoria para que la aleatoriedad siempre sea distinta | ||
} | ||
|
||
private void InitialiceList()//lista que guarda posiciones | ||
{ | ||
gridPositions.Clear();//vacia todo el contenido de la lista | ||
//recorremos con doble bucle para obtener las x y las y como hicimos antes | ||
//empezamos por el x=1 y=1 para dejar un borde | ||
for(int x = 1; x < columns - 1; x++) | ||
{ | ||
for(int y = 1; y < rows -1; y++) | ||
{ | ||
//creamos un vector 2 con la X la Y para meterlo en la lista | ||
gridPositions.Add(new Vector2(x, y));//siempre que uso una posicion tomando en cuenta los sprite multiplico por el tamaño | ||
} | ||
} | ||
} | ||
|
||
private Vector2 RandomPosition() | ||
{ | ||
int randomIndex = (int)GD.RandRange(0,(double)gridPositions.Count);//tengo el total de elementos de la lista | ||
Vector2 randomPosition = gridPositions[randomIndex];//la posicion aleatorio que hemos obtenido | ||
|
||
//una ves que tenemos la posicion la eliminamos de la lista para que no se superpongan | ||
gridPositions.RemoveAt(randomIndex);//remueve la posicion que acabamos de obtener para que no aparescan encima del otro | ||
return randomPosition;//nos aseguramos que no duelva una posición que nos dio antes | ||
} | ||
|
||
private void LayoutObjectAtRandom(Godot.Collections.Array<PackedScene> tileArray,int min,int max)//posicionar objeto en lugar aleatorio//array con todos los muros y creame entre una cantidad minima y maxima de muros | ||
{ | ||
int objectCount = (int)GD.RandRange(min,(double)max + 1);//numero total de objetos que tenemos que crear | ||
for(int i = 0; i < objectCount ; i ++) | ||
{ | ||
Vector2 randomPosition = RandomPosition();//posición aleatoria que recibo de la lista de bloques libres | ||
Sprite tileChoise = GetRandomInArray(tileArray);//tomamos el nodo que queremos instanciar toma como parametro un arreglo | ||
board.AddChild(tileChoise);//hago que sea hijo del nodo board | ||
//importante multiplicar el random position por el tamaño de sprite osea 32..En el caso del position estariamos haciendo una multiplicaión de 1 número por 1 vector,osea 32*X/32*Y | ||
tileChoise.Position = randomPosition * 32;//la posicion es la aleatoria que toma en cuenta las posiciones donde pueden estar los obstaculos y evita que se interpongan | ||
tileChoise.RotationDegrees = 0;//la rotacion es 0 | ||
} | ||
} | ||
|
||
//creo una funcion para crear objetos aleatoriamente pero esclusivo para los objetos que son de tipo kinematicos,osea personajes. | ||
//se ve un poco feo,sin embargo el juego fue diseñado de esta forma | ||
//sino tendria que cambiar toda la gerarquia de los nodos y no vale la pena | ||
private void LayoutObjectAtRandomKinematicBody2D(Godot.Collections.Array<PackedScene> tileArray,int min,int max)//posicionar objeto en lugar aleatorio//array con todos los muros y creame entre una cantidad minima y maxima de muros | ||
{ | ||
int objectCount = (int)GD.RandRange(min,(double)max + 1);//numero total de objetos que tenemos que crear | ||
for(int i = 0; i < objectCount ; i ++) | ||
{ | ||
Vector2 randomPosition = RandomPosition();//posición aleatoria que recibo de la lista de bloques libres | ||
KinematicBody2D tileChoise = GetRandomInArrayKinematicBody(tileArray);//tomamos el nodo que queremos instanciar toma como parametro un arreglo | ||
board.AddChild(tileChoise);//hago que sea hijo del nodo board | ||
//importante multiplicar el random position por el tamaño de sprite osea 32..En el caso del position estariamos haciendo una multiplicaión de 1 número por 1 vector,osea 32*X/32*Y | ||
tileChoise.Position = randomPosition * 32;//la posicion es la aleatoria que toma en cuenta las posiciones donde pueden estar los obstaculos y evita que se interpongan | ||
tileChoise.RotationDegrees = 0;//la rotacion es 0 | ||
} | ||
} | ||
|
||
|
||
public void SetupScene(int level)//esto crea los muros del borde y el suelo..Toma como parametro el nivel para determinar la cantidad de enemigos | ||
{ | ||
BoardSetup();//prepara la escena básica bordes de alrededor y suelo | ||
InitialiceList();//metemos en esta lista todas las pocisiones donde pueden aparecer objetos de forma aleatoria | ||
LayoutObjectAtRandom(wallTiles,5,9);//cada ves que iniciamos la ejecución nos va a crear entre 5 y 9 muros | ||
LayoutObjectAtRandom(foodTiles,1,5);//hamos lo mismo pero ahora agregamos la comida habra entre 1 y 5 objetos de comida | ||
//int enemyCount = level / 2;//cantidad de enemigos en cada nivel.1.2.3.4.etc lo divido por 2 para que la cantidad sea menor y no tenga tanta dificiltad | ||
int enemyCount = (int)Math.Log(level,2);//tambien se puede hacer que el incremento de la dificultad sea de forma logaritmica,supuestamente asi esta en el tutorial de unity aqui se usa en base 2 | ||
LayoutObjectAtRandomKinematicBody2D(EnemyTiles,enemyCount,enemyCount);//Esto crea la cantidad de enemigos dependiendo el nivel,siempre sera 1 número por eso en la aletatoriedad va el mismo número | ||
instanciarSalida();//ahora instanciamos el nodo que posee la salida,osea el sprite | ||
} | ||
|
||
|
||
private void BoardSetup() //metodo para crear el escenario inciial | ||
{ | ||
|
||
//recorremos la X | ||
for(int x = -1; x < columns + 1; x++ )//si el area es 8x8 quiero tambien incluir en ese area el borde,entonces si la x primera es el cero en -1 iria el muro | ||
{ | ||
//recorremos la y | ||
for(int y = -1; y < rows + 1; y++ )//lo mismo pasa en el eje y..Por eso empieza en -1 | ||
{ | ||
|
||
toInstantiate = GetRandomInArray(floorTiles);//devuelve un objeto instanciado de tipo sprite toma como parametro un array de packetscene | ||
|
||
if(x == -1 || y ==-1 || x == columns || y == rows )//si la posicion pertenece al borde | ||
{ | ||
//referencio a un elemento aleatorio del borde | ||
toInstantiate = GetRandomInArray(outerWallTiles);//devuelve un objeto isntanciado de tipo sprite toma como parametro un array de packetscene | ||
} | ||
|
||
board.AddChild(toInstantiate);//hago que el sprite instanciado sea hijo del nodo board para poder tener mejor organizados los nodos | ||
toInstantiate.Position = new Vector2(x * 32 ,y * 32 );//la posición depende de la ubicación en los bucles "for y su X e Y" tambien hay que multiplicar por el tamaño de los sprite | ||
toInstantiate.RotationDegrees = 0;//la rotación del nodo cero 0 | ||
} | ||
} | ||
} | ||
|
||
|
||
//metodo que devuelve un sprite de suelo aleatoriamente del array que le pasamos por parametro | ||
private Sprite GetRandomInArray(Godot.Collections.Array<PackedScene> array) | ||
{ | ||
//referencia al suelo que quiero instanciar uso un rango aleatorio entre los suelos | ||
//hay que tener cuidado si 1 sprite esta invisible puede parecer que no funciona | ||
return (Sprite)array[(int)GD.RandRange(0,(double)array.Count)].Instance();//devuelve un sprite aleatorio dependiendo el array que le hemos pasado | ||
} | ||
|
||
//el problema es que el enemigo no es un sprite,creare la mismo función pero para los enemigos y el personaje | ||
private KinematicBody2D GetRandomInArrayKinematicBody(Godot.Collections.Array<PackedScene> array) | ||
{ | ||
//referencia al suelo que quiero instanciar uso un rango aleatorio entre los suelos | ||
//hay que tener cuidado si 1 sprite esta invisible puede parecer que no funciona | ||
return (KinematicBody2D)array[(int)GD.RandRange(0,(double)array.Count)].Instance();//devuelve un sprite aleatorio dependiendo el array que le hemos pasado | ||
} | ||
|
||
private void instanciarSalida() | ||
{ | ||
Sprite tileChoise = (Sprite)exit.Instance();//tomamos el nodo que queremos instanciar toma como parametro un arreglo | ||
board.AddChild(tileChoise);//hago que sea hijo del nodo board | ||
//importante multiplicar el random position por el tamaño de sprite osea 32..En el caso del position estariamos haciendo una multiplicaión de 1 número por 1 vector,osea 32*X/32*Y | ||
tileChoise.Position = new Vector2(columns - 1,rows - 8) * 32;//la posición del exit esta al borde superior,siemple multiplico por el tamaño del sprite | ||
tileChoise.RotationDegrees = 0;//la rotacion es 0 | ||
} | ||
|
||
} |
Oops, something went wrong.