1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GML Creating a (sort-of) Typing Game Mechanic

Discussion in 'Programming' started by Wolff, Jun 5, 2019.

  1. Wolff

    Wolff Member

    Joined:
    Dec 17, 2018
    Posts:
    4
    Not necessarily a typing mechanic, but one that works similarly.

    I'd like to create a game in which you deal damage by providing the requested inputs that appear above enemies. Instead of typing out words as one would in an actual typing game, the player would use only two inputs (for example, left and right mouse buttons) to input a code that appears above an enemy's head. They would also have to do this in the correct order that appears for each enemy.

    Does anyone at least know of some good tutorials that can offer some coding solutions for a mechanic like this? I have only found a few typing game coding tutorials, but none for GML yet. If anyone can offer some suggestions on how to solve this, I would really appreciate it.
     
  2. trentallain

    trentallain Member

    Joined:
    Aug 6, 2016
    Posts:
    521
    Which way does it work? Btw when I say "key" I mean a keyboard button or mouse click

    1. Press the correct key combo for enemy one, deals damage to it, move to enemy two.

    Or 2. Press the first key, enemies that have that as their first key have that taken off their keys to press, press another key etc etc until there are no more enemies

    3. Some way else?
     
  3. Wolff

    Wolff Member

    Joined:
    Dec 17, 2018
    Posts:
    4

    Ah, I see that I wasn't clear on that part. This game would utilize aiming, as in you would aim with the mouse (using a cursor sprite) which would quickly trigger the code appearing above the enemy's head upon hovering over the said enemy. So you aim, the code appears above the enemy, and while maintaining aim you would use the mouse buttons to input the code, and they would be defeated.

    So not only is the character not stationary (they can move in 8 directions around the room), but their aim can move basically anywhere.
     
  4. woods

    woods Member

    Joined:
    Jun 21, 2016
    Posts:
    223
    i would start with something like this...
    sudocode
    Code:
    if place_meeting(mouse_x,mouse_y,obj_enemy)
    {
    // do stuff like draw symbol over enemy's head
    // set some variable to true
        if some variable is true
        {
        // if symbol is L {//check for mouse click}
            {// deal damage}
        // if symbol is R {//check for other mouse click}
            {//deal damage}
        }
    }
    


    what have you tried already?
    what bits of code are you working with?
     
  5. trentallain

    trentallain Member

    Joined:
    Aug 6, 2016
    Posts:
    521
    Okay so what is would do is like above but using with (place_meeting). I would make every enemy have a ds_queue, which you can fill with as many keys to press as you like, and then when you have your mouse over them, check if the first option in the queue is the same as what you are clicking, and if it is, remove it from the queue. If all the key combos are removed from the queue, destroy that enemies queue and destroy the enemy.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice