• Advertisement
  • entries
  • comment
  • views

Fun Updates this week

Sign in to follow this  


Hey all,
For the first time in several weeks, I was able to get a decent amount done with the game. Most notably, the UI is now clickable and interactive, a tile flipping mechanic was added to the game, and there's now a (rather ugly) player turn icon above the head of the character whose turn it is.

For the clickable UI, I went with a rather simple function that takes the mouse position, and tests it against the various button dimensions and returns an integer that is later passed into the respective function, whether it's for players, tiles, etc, like so:[code=:0]//pull opengl screenCoords from common commands, where 0,0 is bottom left//// glm::vec2 tempCoords = OpenGLScreenCoords(window, ScreenDimensionsIN); //iterates through uiButtons to see if click matches coordinates//// for(int i = 0; i < uiButtons.size(); i++) { if(tempCoords.x > uiButtons.x*ScreenDimensionsIN.x && tempCoords.x < uiButtons.y * ScreenDimensionsIN.x && tempCoords.y > uiButtons.z*ScreenDimensionsIN.y && tempCoords.y < uiButtons.w * ScreenDimensionsIN.y && glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS && keyLMOUSEBool) { //return button that was clicked, set bool to true, reset keys//// uiButtonImages = uiButtonHighlight; keyLMOUSEBool = false; clickedBool = true; ResetKeys(window); return i; } }
The integer it returns is treated much like any key press in the rest of the functions in game. So, to fire a spell, it checks the function parameters for either the keypress, or the integer corresponding to the respective key, if that makes sense.

I'll likely look into whether there is a cleaner or more efficient way to do this, but for the moment, it seems to work fine.

I added a player turn icon above the player's head whose turn it is. Things were rather confusing without it :P The shading, shape and color are all just placeholder until I have time to design a decent looking one.

And, then lastly, I added a tile flipping mechanic/ altar mechanic that flips either the tile the player is standing on, to match their good/evil alignment (players will get an attack/defensive boost or penalty based on the tile they're standing on). The flip one is pretty self explanatory and simply bumps the player up into the air, and flips the tile up with them, and lands as their respective tile alignment. The altar mechanic was a little tricky for me to implement as it deals with both the players and the environment, whose classes don't interact with each other. So, I had to add a function in the main class to handle these (currently, this is how much of the game is set up. With the main class directing things between the players/terrain/ui/etc).

The altar will fall from the sky to the game board, flipping the tiles around it, and anything standing on them, one by one, changing the tile color to match the player's alignment. It's rather fun :) This week, I'll hopefully have it also damage any opposing players in the process, and add some particle effects.

Other than that, I fixed a ton of little bugs, tried to draw some new characters, got frustrated with my drawing abilities and gave up, and generally tried to clean up the code a little. The code is beginning to feel really unwieldy. The entityManager class (i know, i know, verb-class) is rather huge, and probably ought to be split up. Additionally, i need to go through and make sure that only things that are necessary to update every iteration in the game are included in the main Update() function. At the moment, there are several things that could easily only be calculated on changing turns, or even just once every second or so.

Anyhow, you can view the code here or here. I'd welcome any comments, criticism, or especially advice as I'm still rather new to everything.

Here are some images of the ui/icon and flip mechanics. I was hoping to get video of it, but never got around to setting up something to host video. Maybe next week :)
Have a good week everyone :)
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement