Tuesday, March 7, 2017

Learning Godot Day 11

     Today I finished the second tutorial video by adding physics to the cannon ball and effects when firing the cannon.


     This is the added code that makes the cannon ball bounce off of surfaces when it collides in a realistic way. After doing this I added a sound effect for when the cannon fires, I did this by adding a sample player then adding the supplied sound effect to it. I then added a line a couple simple lines of code to make it play when the shoot() function is called. I also added a camera shake effect by adding a camera node to the cannon and then adding a animation player child node to the camera. from there I added 5 different camera offset frames every 0.04 seconds so the camera then shakes for 0.2 seconds every shot.


     This is the current modified cannon code which plays all the new effects that have been added today in the images below.



     Tomorrow I will be starting the next and what looks like the last part of this cannon tutorial series.

Friday, March 3, 2017

Learning Godot Day 10

     Today I was able to fix the problem, it was a simple error that I overlooked involving me typing the incorrect function type into the code.


     The "func _fixed_process(delta):" was lacking _fixed which I overlooked when originally typing the code. The cannon balls now fire and are projected as intended. The new function on the bottom is added through the visibility notifier node I added to the cannon ball node in order to destroy the excess cannon balls that go off screen so they aren't clogging p the hierarchy. Today I also created a tile through a texture that was given to me in the assets folder. Through this i made a 32x32 tile and was also able to create a tile map on the control scene which I find really cool about 2D in this engine. It allows me to paint the tiles I've saved onto the scene instead of filling up the scene with nodes.


     This is the current state of the project, I will continue with the tutorial next day.

Thursday, March 2, 2017

Learning Godot Day 9

     Today I continued from where I left off last day by continuing the tutorial which seemed to only consist of coding.


     Above is the modified code from last day, this is creating a input when "ui_select" is pressed which is also equal to the space bar to make shooting true. _process(delta) always is called every frame so when its "if" statement detects the change in the state of "shooting it and the bullet delay of 1 second has reached it will call the function fire_once() and reset the waited time to 0 so the 1 second must be waited again before fire_once() can be called again. Once fire_once is called it will call the next function shoot() and set shooting to false again so shoot() wont be called more then once. Shoot will then carry out the process of spawning the cannon ball.


     This script was then created and attached to the rigidbody2D of the cannon ball scene to carry out the process of how the cannonball will behave after being spawned by the cannon. Creating a gravitational pull and velocity of where its being launched.

     I ran into a problem however where the ball spawns but does not actually move or spawn where the spawn point is at so I will have to look into this next class.


     As you can see in the picture the cannonball is spawned in the center of the cannon and doesnt actually move which is a obvious problem that most likely has to do which the code of the cannonball script and/or instancing the cannonball into the scene.

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.