Repository navigation
Creating a New Scene and Setup Character
Now you will learn how to create new empty scene which is able to work with this plugin
Open the folder addons>array_rpg in godot's file system
You will see four more folders. One of them is named 'Scenes'. Open that
You will find 'EmptyScene.tscn'. Duplicate that scene and name your scene
We'll refer scene's root node (Spatial). Its Default Name is 'EmptyScene' so we'll refer it like this
Create a script on EmptyScene but before we edit the script, you have to do some settings
You will see a bunch of nodes parented inside of a 'PlayerCharacter3D' node. That's a custom node added by the plugin
Click on that node and you can see we could change some properties which are speed and health. Set it as you want
For my case I set the speed to 10 and health to 100
Now can you see two timers in PlayerCharacter3D.
First is DetectionRateTimer, don't ask me what it does just set its time to 0.01 and enable autostart
The second timer VulnerableTimer decides how much time it will take the enemy to hit once. I will not change anything of this timer
Now let's code something. But before we code we have to see something.
In two custom nodes, PlayerCharacter3D and ItemDetector3D has a custom array property called 'Define'
Click on Array(size [size]) in the side of define property.
It will reveal the names of property which has to be set by code.
Now open the script we created earlier. First we will set the define properties of player.
For that we need reference to the player. To get reference, write $PlayerCharacter3DNodeName (For my case the name is PlayerCharacter3D)
So I will set the define properties like this (I will explain you what each property does later):
ItemDetector: This property asks you to give the node path of ItemDetector3D which is inside our player. To get node path of any node, just right-click on it and select copy node path. You have to paste the node path inside two inverted commas(like this: "") to make it string
DetectionTimer: This property asks you to give node path of DetectionRateTimer inside our player.
EnemyList: This asks you the names of the enemies. For now just enter "Red" as it will be the name of our enemy
Before we get into next property, select the EmptyScene Spatial Node and Ctrl+Shift+A and search for lost screen and select LostScreen.tscn from the list. A Node2D named Lost Screen will be added to screen
LostScreen: Give it the node path of lost screen that we just added
ScenePath: Leave it empty for now as we will change this when we create our enemy
DamagedRateTimer: Give it the node path of our VulnerableTimer node.
Now for the define properties of ItemDetector3D. Referencing is little bit different. You have to write $PlayerCharacter3DNodeName/ItemDetector3DNodeName because its a child of the PlayerCharacter3D node.
PlayerInventory: Give it the node path of Inventory Node which is inside of our player
The coding is finished!
Before you run the game:
Add a camera to the scene
Go to Project>Project Settings>Input Map and add a input key binding named 'Attack' to remove errors
Now you are free to run your game!!!






