I'm somewhat new to programming and newer still to libgdx. I am working on a turn based, tactical, rpg similar to fire emblem or final fantasy tactics, after having worked through some tutorials. So far I have been able to render an enemy, a player, and let the player move in a turn based fashion. Now I want to set up some basic "AI" for the enemy. basically I want it to move along the X axis until it is 1 tile away from the player, but for some reason it is not working. here is the relevant code. if anyone has any help for a newb it is appreciated.https://pastebin.com/MpkU8BBnhttps://pastebin.com/dwHPhRiKhttps://pastebin.com/5juT8jez

so I have been playing around with the code and I think i have figured out the fundamental issue im having. any help is greatly appreciated.

at the end of the (player) move method i have a condition.if(energy==0){ playerturn=false; }basically once the player has used all of their energy, the boolean that controls if the player move or enemy move method is active, is set so that the enemy has their turn. however the enemy move method doesnt seem to recognize the change in the boolean's state. it starts off as such:

public void enemyMove(EnemyCharacter activeEnemy){

if(playerturn = false){ System.out.print("test");but it never prints out test in the console.however if I change the enemy move method to:

public void enemyMove(EnemyCharacter activeEnemy){

if(energy==0){ System.out.print("test");

it starts to work. I dont understand why using energy to change a boolean value doesnt work but relying on the energy value itself does. Once again thank you for any help you can give!

I'm somewhat new to programming and newer still to libgdx. I am working on a turn based, tactical, rpg similar to fire emblem or final fantasy tactics, after having worked through some tutorials. So far I have been able to render an enemy, a player, and let the player move in a turn based fashion. Now I want to set up some basic "AI" for the enemy. basically I want it to move along the X axis until it is 1 tile away from the player, but for some reason it is not working. here is the relevant code. if anyone has any help for a newb it is appreciated.https://pastebin.com/MpkU8BBnhttps://pastebin.com/dwHPhRiKhttps://pastebin.com/5juT8jez

First off, I think you should scale down your project considerably. Since you are new to programming, and particularly graphical programming. (I suspect you got into it because you wanted to make games, right?) You'll get alot more out of making a graphical tic-tac-toe game as a beginning.

To answer your question though, if you want a turn based system you would have to split the logic between "player turn" and "process entities" for that turn once the turn is complete, for every turn.

Just to give an idea of just how much you'll need to work out :- player controls- leveling- map loading- camera controls- NPC's - enemies- probably going to need pathfinding- collision detection (with enemies for fighting, NPC's for talking, etc)- a quest system (because there needs to be a reason to go into the dungeon)- HUD- Inventory system- save / load- sound / music- transitions- finally, getting into the finishing touches of special effects, transitions, etc.- almost forgot, then the balancing... because you don't want your level 3 mage to be able to take down the last boss

Another factor, because you are going to wind up with hundreds of classes and sub-classes and dealing with alot of similar but slightly different code (a rat will use similar logic to a warlock, but the warlock might be able to cast spells), so, before you get into making an RPG, you will probably want to get into an entity based system (like ashley). That involves it's own learning curve thinking in terms of components and systems that process those components.

So, you'll be much better off if you only need to concern yourself with:- defining the map (3x3)- determine whose turn, whether player or AI- determine a winner

Then, after 2-3 weeks working on that and getting it solid, you'll be much better prepared for something a bit more complex...

After working on increasingly larger projects your confidence and skills will improve and you will have a better sense (and a code base).

I can tell you from experience, when you start on a too large of project you will not consider things that may not seem important but will ultimately break your code as you add to it. That frustration leads many to just give up. Better to start by debugging a project with 5-10 classes than when your project is 20% done and you've got to sort through 50+ files to determine which interaction is causing some obscure bug.

There's a reason why a game like final fantasy tactics took a team of around 200 people several years to complete.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org