JELLE VAN DOORNE - GAME & NARRATIVE DESIGN
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit

Action Commands (and Levels!)

16/6/2018

1 Comment

 
This time, the video showcases more than just what I worked towards this week. The past two weeks, I've also been spending time creating a full level: first in graybox, then creating a tileset to give it visuals. Obviously, the level's still incomplete, so this blogpost will just be about the action commands.

Click 'Read more' to go a little more in-depth with the action commands.

The Action Faction

The action commands were, in theory, very simple. There's no timing behind the scenes for when you need to press buttons, no scripts running in the background to keep track of button presses. Instead, I simply move the buttons across the screen using a coroutine. The buttons, as well as the UI element containing them, have 2D colliders that function as triggers. Once they overlap, the player can press that button to register either a "regular" or a "perfect" hit to add to their damage. If they press the wrong button, or no button at all, it'll register a "failed" hit and reduce damage.
Picture
This is probably the most important part of the code. Woah, nestled ifs! I don't like using them because they make code more confusing, but a few else parts were necessary.

The code has three booleans it uses to keep track of what kind of hit is done by the player. If any hit has been done, it should stop changing those booleans, hence the first if. Within that, it needs to check whether the buttons are going (a boolean turned on when the first coroutine starts), and whether a button is pressed. This is where we need to nestle again: if the player presses the incorrect button, they will get a failed hit. If they press the correct button when certain bools are on, the player gets a perfect hit or a regular hit. These booleans are turned on when the button colliders overlap the colliders on the action bar.
Picture
The colliders on the action bar and buttons.
Picture
Once a button stops moving it triggers this method. It adds up the amount of hits, then checks whether it's spawned enough buttons. If so, it triggers attack calculation and resets the number of hits afterwards, ready for the next turn.
Picture
Calculating attack damage now takes into account the amount of hits, and increases or reduces damage based on that. Once I've got animations, I want to separate the amount of damage for each hit so every button press corresponds with a character's attack.

Next week, I'll be working on making the monsters available in the level, and letting the player win or lose.
1 Comment
Matchmaker Baton Rouge link
23/5/2024 00:42:02

Hi nice reading yyour blog

Reply



Leave a Reply.

    Tweets by GameViola

    About

    This is a development blog for my own game project, "Viola".

    Picture

    Archives

    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018

    Categories

    All
    Art
    Design
    Music
    Programming
    Story
    Viola

    View my profile on LinkedIn

    RSS Feed

Site

Portfolio
About
​Contact
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit