Makers Blog (12 Part Series)
So at the start of this week, we started working on the front end. We were using "erb" and "Sinatra". It's more rewarding to see something visible after putting in some work rather than having to look into the terminal to see if what you've done does anything.
This week started with a lot of "erb", we were only using the parts similar to HTML, as well as a bit of "CSS". We were also learned about "HTTP" requests and about routes. There was a lot of info to absorb although I had learned bits and pieces leading up to the course so it wasn't too daunting.
We got a bit further through the work on the second day moving onto forms and integrating user input, which was interesting. We were able to take a name off a user and input it to the top of our web page. We also learned how to input something manually using query strings. I got to play around with capybara which is used for testing user input. It was interesting to how that worked and to see how we could use a webpage through "pry".
This is where we started our challenge which was a battle simulator, it looked an awful lot like pokemon. So basically it going to be a turn-based game where each player is given a chance to attack. But we have to start by taking player names. which we used a form for we had a lot of problems with this cause we were using shotgun. We later found out that shotgun isn't very compatible with sessions which had us stumped for a while. But at least we got it working and managed to put the names up on display. It was cool to see a dynamic webpage that we created.
We got to move onto adding a player and game class at this point. It meant we had a game class which would start when you submitted your names. This would also make two players with the names provided. which keep everything together making everything neater. We also got around to adding hit points and an attack method but we didn't get around to using it.
Today we started by using the attack method to do damage to player 2. We then moved on to making our controller a bit less cluttered. We removed the player 1 and 2 instance variables and move them into the game class. We then moved onto getting the game to switch player turns which we managed to do before running out of time.