As you can see in the gif from the game im talking about, the player character within the space of the “striped” tiles which can increase when your agility stat increases too, he can throw spells and also (although not shown in the gif) melee attack the enemies when being near them enough.
And what part you don’t understand?
Cause all i see here are 2 things
1 - Agility should determine distance in pixels from your spawn point to move
For example where you start does not matter but you save that position to two variables one for X other for Y
Imagine your player agility is 15 (very low but just for example lets go with it)
Now you need to make event like
Player X position is less greater than Variable holding that starting X pos -15
Left key pressed
Action
Simulate player move left
For right it would be
Player X position is less than Variable holding X position +15
Right key is pressed
Action
Simulate player move right
And now you repeat that for Y pos up and down
You could even change size of some sprite object or spawn some sprite object to mimic that rectangle around player indicating field of movement
LASTLY after turn you would need to overwrite these 2 vars holding X and Y pos of player to hold new X and Y starting pos of player
Now
2 - would be for melee attack is just conditon
Distance between player and enemy is below SOME NUMBER HERE
So like distance in pixels lets say 10
And in action you simply however you want allow melee attack to be executed and that is pretty much it
(I only tried the “movement” part so far) It doesnt seem to work, theres no limit for the character’s movement.
(Also sorry for replying so late).
Sorry, here it is:
Here is also another in-battle gameplay btw
You have wrong idea what you should do
Look imagine Player2.Agaility is idk 20
So what if your player X position is 150?
You are comparing it wrong
It should be
The X position of Player 2 is GREATER THAN Player2.X()-Player2.Agility
And now it would make sense
Cause IF player position is idk 100 and agility is 20
You are checking if player position is greater than 80 in this case
BUT that creates another conflict
In fact what you should do is
When there is player turn save to 2 variables player X position and Y position
Let’s call them Xpos and Ypos
Now you check
The X position of Player 2 is GREATER THAN Player2.Xpos()-Player2.Agility
And now you would have exactly what you want
You could even draw rectangle using Xpos and Ypos
AND LASTLY 2 things
1 - you would need set Xpos and Ypos to position of player with condition having trigger once
So it is not updating on each move
2 - EVERYWHERE here
You are checking if it is less than and that is wrong
For moving left you check if its Greater than
For right Less than
For up Greater than
For down Less than
You are changing Xpos and Ypos constantly
You should set it only once when player move turn starts BEFORE even player can move
For sure you need there trigger once with some sort of condition that checks if it is player turn to move
If you change turns via variables then that would be what you need to check in condition
Look
Press space to enable/disable player turn
WASD to move
Also do not create new text object to print every single variable
You can write something and then add + "AND HERE HOLD SHIFT AND PRESS ENTER
"+ and that is how you make new line
Here is how i shoved in 5 different things into one text object which you see in upper left corner
"Player Turn "+PlayerTurn+"
Xpos "+Xpos+"
Ypos "+Ypos+"
Player Center X "+ToString(Player.CenterX())+"
Player Center Y "+ToString(Player.CenterY())
Lemme copy the events you put in that picture and ill tell you if it does or does not work
I do not need that kind of information
You have on screenshot exactly what i used in events
IF it does not work it means you did not copy it 1 to 1
So this would be indication for you to re check each event did you copy it exactly as i have them
WHERE BE AWARE
Order of events (in most cases) is crucial here
You move some action/condition higher/lower than it is on screenshot and you gonna break it
And before you ask it is 100% doable to make NONE part of player leave red rectangle
I simply set it to check player center cause i am lazy
So if you gonna need that just ask
Ok so it now does definitely work and I now wanna know how to make the player not leave the red rectangle pls
Be aware that white rectangle is resolution of my image
So look HOW MUCH empty space i have there
So you do not get confused by why it is not going perfectly to the edge when in reality it is
And this is same as above
But it is perfectly hitting the edges
Where i manually added these numbers on end
I mean i don’t know where to put + or -
Where to put 2 or 1
I did put - 2 everywhere and checked if i need to put there more or change - to +
How do I make the enemy ai? I already tried with these events but they didnt work:
And yes the player movement part works excellent
I do not understand what you are doing
And if you check if value of variable is random in range
It mean you spam it constantly
Also reply to last message when you are making post here cause otherwise no one is getting notification about your message
And it is easy to miss it
I just find this message of yours by pure accident
- I wanted the enemy to move towards the player
- I replied to your message, sorry anyways
Yeah and now i got notification
But i have no idea for what you are sorry? Well does not matter
Why you use random in rage in condition for that?
You want enemy to pick random time and then move toward player or wat?
You know what? Im gonna only make it move and make it attack the player (or atleast make it blink) when its close enough
Now i am even more confused
Like when you showed me game you want to recreate what i did understand from it was
Enemy turn = enemy moves toward player
Enemy turn = enemy is close enough to player so enemy do not move and attack
Enemy turn = Enemy not close enough to player to attack so he approach player but he reaches player before his available moves end so he perform attack
Then i saw random in range and i was like wai?
Now i think you are willing to go back what i was assuming from the start
BUT i would wonder do you want to move enemies ALL at once
Cause for me it would be more reasonable to move enemies one by one
One enemy finished his move you then move to next enemy
And that would be easy to achieve