This week was pretty productive. We were able to make the attack function work exactly as we wanted it to. When we started the week, we had an attack function that would never stop. Essentially, the player character could constantly attack by holding "x", which was extremely broken as the character would never take damage when he was attacking, and he could move and such while he was attacking. This was not good. Ideally, we wanted to make the attack so if the player held the attack key, the attack would end and not re-start. This would force the player to only attack when he needed to and to rely on his or her reflexes to lead him to victory rather than an unbalanced combat system.
We made a series of "if" statements to make it so the same thing wasn't happening at every second the player was pressing the "x" key. We had to do this because apparently JavaScript treats button presses as statuses rather than events. This actually really didn't work in our favor. If JavaScript treated button presses as events, we literally wouldn't have to do any work, because we only want the attack to happen once-per-press. To do this, we made three "if" statements that (we think) cover every possibility for a button-press. One: if the time between attacks had elapsed and the button was not pressed in the millisecond before; two: if the button was still being pressed during an attack and the button was pressed in the millisecond before; three: if the button was being pressed after the attack ended but had also been pressed the millisecond before. The first two conditions would lead to the attack animation being played, but the third would not. This fixed it. YAY
Friday, April 8, 2016
Related Posts:
Here stands the hero of our journey, Frobot. He is a disco-dancing cyborg, endowed with an afro and armed with major groove. As a small boy, he was experimented on and converted into half man, half machine. As a result, he ha… Read More
Week 2Most of this week was dedicated to figuring out how to put our game online. What we thought would be a simple task was actually quite difficult. After purchasing a domain from GoDaddy, we struggled with actually getting the g… Read More
Week 4Hello all! As most of you know, my blog and Alex's got blog of the week last week, which is super exciting! Hopefully I can keep it up in the weeks to follow! This week began with a decision to extend the previously-completed… Read More
Week 3This week was all about making our own level 1 and putting it into the game, with original art for the character sprites. By this point in our project, Alex and I have reached the place where we can work independently of one … Read More
Week 1On Monday, Alex and I began our Senior Research Project as we entered the office of our mentor, Mark Vange. Our first day was primarily dedicated to setting up a schedule with Mr. Vange both in terms of when we would come int… Read More
Subscribe to:
Post Comments
(
Atom
)
Glad to see that the game is balanced again! Are you planning on adding a secondary attack?
ReplyDeleteYour game has come a long way! How are the statuses and events different?
ReplyDeleteGreat question Sparshee! I am curious about the answer too.
DeleteWhen you are coding do you actually type your "if statements" just like you did? How does this look when it is actually coded?
ReplyDeleteSo glad to see all the progress you've made! Have you come across any coding issues with the if statements?
ReplyDelete