• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GML Creating a (sort-of) Typing Game Mechanic

W

Wolff

Guest
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.
 

trentallain

Member
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.
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?
 
W

Wolff

Guest
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?

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.
 

woods

Member
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?
 

trentallain

Member
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.
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.
 
Top