Monday, February 27, 2017

Learning Godot Day 8

     Today I started by adding the collision box to the cannon scene with a collision polygon2D node and also added the bullet spawn point with a position2D node for the bullets to have an area to spawn from the cannon.


      I then referenced the scene in the control scene which is the main scene and where the game will be played from.


      I then created the bullet by creating a new scene and importing the bullet texture to a new sprite node. I also added a shape collision and changed it from a square to a circle collision box to properly represent the shape of the cannon ball.


     After that I added a script to the cannon node and began the coding to make the cannon fire which will be in the screen cap below.


     This code is unfinished and will hopefully be finished next session, most likely the first part of this tutorial will be complete by the end of the next day.

Thursday, February 23, 2017

Learning Godot Day 7

     So today I decided that I need to learn a little more then simply pausing and un pausing a game especially since I was already successful in this area so I'm closing the pong project for now and spent some of this class looking for a new tutorial to show me some more advanced godot mechanics and settled on one on youtube which will create a cannon shooting game the destroys enemies with health bars, this will each me about how to use the physics nodes and how to code in a cleaner fashion. So far Ive only created the first couple scenes one being the controller and the other being the cannon scene where I also imported the cannon texture (I downloaded all the assets needed for the project from the link provided by the tutorial.


     Tomorrow I'll most likely finish setting up the scene and begin coding some of the game mechanics, I'm excited to start working with the engines physics engine, I never used it in the pong game which could've cause difficulties when moving to the main project of the semester. Zach is still creating the first character's sprites so I'll continue to keep myself busy by increasing my knowledge of the engine until I have enough resources to being working on "Project Zenf".

Wednesday, February 22, 2017

Learning Godot Day 6

     Today I was successful in creating a way to properly restart the game at a game over through the user's actions. I did this through a different but much better method then I originally Intended but it showed me how godots UI works and I actually really like how simple it is to add UI elements into the game. I added a button node into the game and had it display "Press to play again!" Doing this helped with the needing a new function to code the un pause in because connecting the node to the script creates its own function isolating it from the pause state if I choose the property from the node inspector.



     This created a function where I was able to code what happens when the button is pressed via a left mouse click but im sure I could change what triggers this button effect I figured the mouse click was the most reasonable element to use.


     This is the modified winner portion of the code which I added showing the button since its starting state is hidden due to it not being needed when the game starts.


     This is the new portion of code which sets all the nodes that where effected by the game play back to their original state allowing a totally refreshed game.


     This is what the game now looks like when player 1 is victorious, after the gray button is pressed the winner text will disappear, the button will disappear, the scores will reappear and will be reset to 0, and the game will un pause. Next class now that I understand how the pausing system works in godot I'm going to try adding a way to pause in game and if that is accomplished without many problem I may attempt creating a simple main menu, which will most likely be a challenge in itself since I'm not totally familiar with how the UI system works but it will be a learning experience.

Tuesday, February 21, 2017

Learning Godot Day 5

      So today I ran into an issue involving the pause function, where it appeared that as expected nothing worked anymore in this state, however this seemed to prevent me from calling get_tree().set_pause(false) to properly unpause the game. I actually found out that not only does it pause all nodes that are not white listed in the scene, but also will not call certain functions, one of them being "func _process(delta): which was what I happened to be putting my unpause call in so that part of the script to unpause the game was never actually being read to be able to unpause the as the function it was in was no longer being called in the paused state. Basically I need to create a function that is still called when the game is paused, I'll need to do some further research into this next class but I hope to be able to properly unpause the game by the end of tomorrows session. I have no new screenshots as of right now due to not much changing in the main code, just me going through trial and error after discovering new details on the forums about this pause function. Having a built in pause function to the engine is quite helpful but apparently more complex then anticipated so I will delve further in tomorrow.

CURRENT CODE

    Tomorrow I will figure out how to call a function during the paused state of the game in order to create a loop like effect with the restart system I plan on implementing.

Friday, February 17, 2017

Learning Godot Day 4

     Today I was successful in making a pause function when a player reaches 5 points, this is simply done by creating a new if statement and adding a true false statement looking for a player to have a score of 5 or greater, and if so adding the line of code "get_tree().set_pause(true)" this pauses everything in the game excluding anything that is white listed in the editor.
      The code here also adds a text when a player wins depending on which player was victorious and displays it on the screen. I also made it so that the color of the text matches the same color of the player who won. I also imported a custom text since the engine does not support a way to up/down scale a font without importing it so I decided to try that as well to be able to make a large text.
     Settings of importing a custom text is above.
     This is the result, the code also hides both score keeping labels to make a cleaner looking win screen, tomorrow I will attempt to create a prompt in text that prompts either player to hit a key to restart, and then try to follow through with the prompts words by coding a restart function.

Thursday, February 16, 2017

Learning Godot Day 3

     Today I was successful in creating my score counter and also got a start in making a winning player at x amount of points. To get the score to properly display on the playing screen I had to use a trick that allows me to treat the int value of the current players score as a string value so the label could properly read the information being fed to it as seen in the screen shot below.


     Actually creating the counter itself was easy enough by splitting the code that resets the ball to center position to a left side and right side I was able to use them as two different functions, one being for player one and the other for player two. Then after that I added a simple line of code "player_one_score = player_one_score + score", one being replaced with two on player two's side, this created a functioning counter that now also displays in game. I also changed the text color to match the players paddle however that's as easy as changing a font color in anything. After I was happy with the counter I began working on ending the game when a player hits the score cap which in this case will be 5. Here's the code I used to create the text that displays depending on which player reaches the score cap first.


     Now this only displays a simple text but does not actually stop the game from playing, this is what I'll be trying to accomplish tomorrow, making the game actually stop and making a way to restart potentially creating a prompt such as "Press 'Enter' to play again!". This is what the current version of the game looks like when player 2 is victorious.


     This concludes the events of today.

Wednesday, February 15, 2017

Learning Godot Day 2

     Today in my attempts to create a working score counter has been halted slightly due to my lack of knowledge of the language relationship to the engine, I'm trying to find a way to have the game display the current score of each player through the use of the label nodes, the game now counts the score in the code but I have no way of retrieving it and putting it into text form for players to read.


     The two variables where already declared, the labels have been implemented into the game already as well, however the only specify who is player 1 and player 2, they do not count the score yet.



     A majority of this class has been spent trying to research how to do this successfully, hopefully next class I am able to find my break through, if I am successful in that it shouldn't take too long to implement that function and I will continue on to creating a proper game over screen that declares the winning player in text and stops the game completely. 

Tuesday, February 14, 2017

Learning Godot Day 1

     Zach and I will be working together to create a fighting based style game this semester using the Godot engine, with him creating the sprite artwork and me putting them together and coding the functionality of the game. The Godot engine however is new to me and although the code Godot uses is much simpler to the C# I'm used to, it is still unfamiliar ground so I will most likely be taking the month to get used to me new territory I will be using to create our game. I started off by following Godot's own tutorial on creating a pong like game to learn the ropes of the engine. The engine uses a node system in sorting its scene.


     This is what the final scene look like after all the nodes in the upper right are put together. Creating a pong field out of only 4 nodes and textures which where supplied from the site. I then added a script to code the functionality of the game, Godot uses a version of python as its primary language for the engine.


     This is the final code of the project and makes a relatively linear pong project, but definitely has helped me work around the engine. The engine itself has a lot more simple of an interface then unity and I also appreciate the more simple and easy to use language that godot uses (Also supports C++). Next class I wish to expand on the pong project since I already have the base game here and coded, my first task will be to add a score board for both players, and have a "Player 1 Wins" and "Player 2 Wins" text display upon whichever player is victor. This will not be done following a tutorial and is my own attempt to expand on knowledge of this engine to better help for the big project next month.