• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

DnD - Rhythm Game - Some questions

D

dirtgoblin

Guest
Hello,

I am making a prototype for a rhythm game. I have been using a few tutorials (mix and matching what has been needed) from the following series:


and



However, I have run into some questions

I am using Drag n Drop, as I am not all that familiar with coding

Here is what my prototype looks like so far:



Top Left = Target
Top Right = 3 buttons that are notes, S is for the left trigger, F is for the Right Trigger
Bottom = Left Trigger and Right Trigger


Currently Working

Mouse over Left and Right Trigger - swaps to mouse-over animation
Click Left and Right Trigger - swaps to clicked animation, subtracts 10 from score if the S/F note is not over the target, adds 10 to score if the S/F note is over the target, also plays coinciding sound

Current Issues

Once the player clicks the trigger correctly (timing the note over the target), I want that note to destroy itself, however when I tried using destroy instance it destroyed EVERY instance of the S note. When I tried to do destroy at position, I cannot get the game to register the position of the note over the target.

My DnD breakdown

Destroy Instance (which destroys ALL S notes, not just the one I am trying to target)



Destroy At Position (doesn't recognize the Target as the area used to destroy the S_note)



If someone could offer an help, it'd be greatly appreciated.

Thanks!
 
Last edited by a moderator:
D

dirtgoblin

Guest
Sorry, Aura...I still don't quite understand --- I know next to nothing about coding and was trying to build the game in DnD if it was completely possible.
I am not a coder, but an artist trying to work around as much coding as possible to create this game. Using the links you've given me, I'm even more confused but have attempted several different things with my game.

I inserted a piece of code after the DnD Set the score relative to 10 that said:


with (instance_nearest( x, y, obj_beatbar); { instance_destroy(); }



But this did not work. I do not understand the syntax of what I am trying to ask the game to do, despite knowing that I want it to do the following:

When I left mouse click obj_beat1:

play snd_sneeze
check if obj_notesneeze is at the position of obj_beatbar
if this is true, then set the score to +10 relative and delete the nearest instance of obj_notesneeze to obj_beatbar
if this is false, then set the score relative to -10


My attempts at understanding the GML syntax would make me want to write it as the following

if mouse_check_button_pressed(mb_left)
{
audio_play_sound(snd_sneeze, 10, false);
}

But after this I have no idea how to code it, which is why I was using the DND



Edit:

I also tried the following

if collision_point(x, y, obj_beatbar, false, true) with (instance nearest(x,y,obj_notesneeze));
{
instance_destroy();
}

But this provided errors as well
 
Last edited by a moderator:
A

Aura

Guest
First of all, you're not supposed to end a with construction with a semi-colon. If you read the Manual entry that I linked you to, you'd know. Take this piece of code for instance:

Code:
with (obj_ball)
{
x = random(room_width);
y = random(room_height);
}
As you can see, it's with (obj_wall) (without a semi-colon at the end).

And you can do what you want by using collision_rectangle() or collision_circle(). For reference: You can produce the "relative" effect by using expressions such as y - 56 and x - 52. If you can't get it working, please let me know. ^^
 
D

dirtgoblin

Guest
Thank you for your help. I did read the manual, both before you suggested it, and again after you posted the links, which is why I said I don't quite understand the syntax still.

I will continue working on it later today, and most likely be back with an update on my progress.
 
Top