Jump to content


Photo

Double Tap?


  • Please log in to reply
12 replies to this topic

#1 martinmrcool

martinmrcool

    GMC Member

  • New Member
  • 95 posts

Posted 01 June 2009 - 08:54 AM

hi im making this game and he has like 2 ultimate moves and i was thinking it wouldent
be that cool if it randomised between 2 moves so i was wondering if there was a way so
that if you tap the button once he will do one move and if you double tap it you do the
second?
and if possible is there a way of making like a number come up if you tap it once and a second if
you tap it again.
if possible could you show how to add it into the code because im sure i could figuire out the rest.
im learning coding and untill i get it you will be cing alot more of me... lol :)
anyways thx plz reply

Edited by martinmrcool, 02 June 2009 - 08:36 AM.

  • 0

#2 SP)iNsomnia

SP)iNsomnia

    GMC Member

  • GMC Member
  • 588 posts
  • Version:Unknown

Posted 01 June 2009 - 09:02 AM

hi im making this game and he has like 2 ultimate moves and i was thinking it wouldent
be that cool if it randomised between 2 moves so i was wondering if there was a way so
that if you tap the button once hewill do one move and if you tap it again you do the
second?
and if possible is there a way of making like a number come up if you tap it once and a second if
you tap it again.
if possible could you show how to add it into the code because im sure i could figuire out the rest.
im learning coding and untill i get it you will be cing alot more of me... lol :)
anyways thx for reading and im sorry about the last post i did, the problem was realy frustrating
, ended up being { and } where in the wrong places
anyways thx plz reply


There are no constraints if programming. You can do everything you want to, you just need a lot of exepriences and logic thinking.
Show us your code and we will be able to help. And for next time, try to give us more info. Maybe style of your game and codes ...

iNsomnia
  • 0

#3 lostprophetpunk

lostprophetpunk

    GMC Member

  • New Member
  • 351 posts

Posted 01 June 2009 - 09:07 AM

Create event...
ultimate = 0

Keyboard tap event (whichever you have it as)...
if(ultimate = 0)
{
	  // First Move here
	 
	 ultimate = 1;  //Sets the ultimate variable to 1
}else if(ultimate = 1)
{
	  // Second Move here
	 
	 ultimate = 0;  //Sets the ultimate variable back to 0 so it can be done again
}

Hope that helped a bit.
  • 0

#4 martinmrcool

martinmrcool

    GMC Member

  • New Member
  • 95 posts

Posted 01 June 2009 - 09:25 AM

Create event...

ultimate = 0

Keyboard tap event (whichever you have it as)...
if(ultimate = 0)
{
	  // First Move here
	 
	 ultimate = 1;  //Sets the ultimate variable to 1
}else if(ultimate = 1)
{
	  // Second Move here
	 
	 ultimate = 0;  //Sets the ultimate variable back to 0 so it can be done again
}

Hope that helped a bit.


i think i dident realy write it properley
i am trying to get a code for pressing the z button once will=ultimate att1
and taping it twice will=ultimate att2
so like if im playing i press "zz" for ultimate move 2 or if i want number 1 i press "z"
kinda like kirby for double tap running
1st tap= walk and second = run
  • 0

#5 Jaeke

Jaeke

    GMC Member

  • New Member
  • 4 posts

Posted 01 June 2009 - 11:46 AM

I don't know anything about coding, or game maker, or anything, but here's how I'd do it with my limited knowledge of DnD.

lostprophetpunk said something along these lines.

I'm not sure how to do it for attacks without initiating ultimate attack 1 first. Some kind of delay? Initiate ultimate attack one after a 5 step delay. So ultimate attack 1 would initiate in the alarm event.
Perhaps...
[codebox]

Create event
key_tapped = 0

Key press event
IF key_tapped = 1 // If you had previously pressed the key in the last 5 steps
Ultimate attack 2 // begin ultimate attack 2
Ultimate attack 2 initiated = 1 // So it doesnt make attack 1 go off as well in the alarm 0 event
Set Alarm 1 to (however long your attack lasts) // So you aren't permanently doing ultimate attack 2
ELSE
variable key_tapped = 1
ultimate attack 2 initiated = 0
set alarm 0 to 5

In Alarm Event 0
IF ultimate attack 2 initiated = 1 // So it doesnt make attack 1 go off as well
Exit this event
Else
key_tapped = 0
Ultimate attack 1

Alarm 1
Ultimate attack 2 initiated = 0 // So you aren't permanently doing ultimate attack 2


[/codebox]

Damn, I just confused myself trying to keep track of what I was doing, I'm not sure if that works. It's no doubt excessive. Please tell me if this is wrong or just plain stupid.

Edited by Jaeke, 01 June 2009 - 12:27 PM.

  • 0

#6 martinmrcool

martinmrcool

    GMC Member

  • New Member
  • 95 posts

Posted 01 June 2009 - 12:05 PM

I don't know anything about coding, or game maker, or anything, but here's how I'd do it with my limited knowledge of DnD.

Martinmrcool said something along these lines.

I'm not sure how to do it for attacks without initiating ultimate attack 1 first. Some kind of delay? Initiate ultimate attack one after a 5 step delay. So ultimate attack 1 would initiate in the alarm event.
Perhaps...

Create event key_tapped = 0Key press eventIF key_tapped = 1                   // If you had previously pressed the key in the last 5 stepsUltimate attack 2                     // begin ultimate attack 2Ultimate attack 2 initiated = 1                                // So it doesnt make attack 1 go off as well in the alarm 0 event Set Alarm 1 to (however long your attack lasts)    // So you aren't permanently doing ultimate attack 2   ELSEvariable key_tapped = 1                             ultimate attack 2 initiated = 0                 set alarm 0 to 5In Alarm Event 0IF ultimate attack 2 initiated = 1                // So it doesnt make attack 1 go off as well Exit this eventElsekey_tapped = 0                                 Ultimate attack 1Alarm 1Ultimate attack 2 initiated = 0             // So you aren't permanently doing ultimate attack 2

Damn, I just confused myself trying to keep track of what I was doing, I'm not sure if that works. It's no doubt excessive. Please tell me if this is wrong or just plain stupid.

thx but this code dosent realy work, lol we are like on each others lvl in coding
i lose track of what im doing alot to
  • 0

#7 slash3r

slash3r

    GMC Member

  • New Member
  • 63 posts

Posted 01 June 2009 - 12:15 PM

i guess mine works

create:
timer=0

step:
if keyboard_check_pressed(vk_right){
  timer+=1}

if timer>6{ //checked with keyboard how fast i can double tap, i can do it under the 0.1sec = 3 steps i made it 0.2sec maybe you want to set it to lower then 6
  timer=0}

if keyboard_check_pressed(vk_right) && timer<=6{ //this is also that 6
  do move 2
  timer=0}

you also can use keyboard_check_pressed(ord("F")) for the f key etc...

Edited by slash3r, 01 June 2009 - 01:17 PM.

  • 0

#8 Angelo

Angelo

    GMC Member

  • New Member
  • 168 posts

Posted 01 June 2009 - 12:29 PM

I'm not gonna post code cause I'm a bit preoccupied, but here's what you do.

You create an alarm, say alarm[0].

On the key press event code(your attack key):
1) You check if alarm[0] > 0, and if it is, you execute the special move, and set alarm[0] = -1, in order to stop the countdown.
2) If it isn't, you make the alarm[0] start counting for whatever you want (the time the player has to tap the key a second time).

By the way for the alarm to work it has to have code in it, so you should put something (anything).

Hope it helped.

Edited by Angelo, 01 June 2009 - 12:30 PM.

  • 0

#9 lostprophetpunk

lostprophetpunk

    GMC Member

  • New Member
  • 351 posts

Posted 01 June 2009 - 12:34 PM

This may be a different way to do it...

In the create event of your character or whatever you want to use it for...
ultimate = false; // sets the 'ultimate' variable to false, so the character can only do the first thing

In the step event of your character or whatever you want to use it for...
if(keyboard_check_pressed(ord('Z'))) // Checks to see if the letter 'z' is pressed
{
	 if(ultimate = false)
	 {
		  // Put your first move here

		 ultimate = true; // sets the 'ultimate' variable to true, so that the player can use their ultimate move
	 }else if(ultimate = true)
	 {
		  // Put your second move here

		 ultimate = false; // sets the 'ultimate' variable to false, so that the player can use their first move
	 }
}

I have checked the code and it works.
  • 0

#10 Echo_512

Echo_512

    GMC Member

  • New Member
  • 200 posts

Posted 01 June 2009 - 12:40 PM

jut use an alarm, that simple.

like:

clicky event thingy:
ultimate+=1
alarm[0]=10

alarm 0:
if ultimate<2 {
// move 1 here
}
if ultimate>1{
//move 2 here
}
ultimate=0

Edited by Echo_512, 01 June 2009 - 12:44 PM.

  • 0

#11 slash3r

slash3r

    GMC Member

  • New Member
  • 63 posts

Posted 01 June 2009 - 12:41 PM

@ lostprophetpunk

like this it does move 1 move 2 move 1 etc... right?
thats not what he wanted he wanted a double tap: move 2 and if not double tap move 1
or maybe it works (does first move 1 but if you double tap you wont see that and he does move 2)
but eh one problem i guess if you press Z and hour later again it does move 2

btw i hate it when people dont look if theres already a good awnser and post a worse one

if you think someones doesnt work you say that doesnt work and then say how it should or how you would do it!

Edited by slash3r, 01 June 2009 - 12:43 PM.

  • 0

#12 martinmrcool

martinmrcool

    GMC Member

  • New Member
  • 95 posts

Posted 01 June 2009 - 12:49 PM

I'm not gonna post code cause I'm a bit preoccupied, but here's what you do.

You create an alarm, say alarm[0].

On the key press event code(your attack key):
1) You check if alarm[0] > 0, and if it is, you execute the special move, and set alarm[0] = -1, in order to stop the countdown.
2) If it isn't, you make the alarm[0] start counting for whatever you want (the time the player has to tap the key a second time).

By the way for the alarm to work it has to have code in it, so you should put something (anything).

Hope it helped.


well your code seems like my best bet, to bad its not in detail
anywasy good night its 10 here and i need sleep
thx everyone ill look over you codes in the morning
thx all
  • 0

#13 martinmrcool

martinmrcool

    GMC Member

  • New Member
  • 95 posts

Posted 01 June 2009 - 12:54 PM

@ lostprophetpunk

like this it does move 1 move 2 move 1 etc... right?
thats not what he wanted he wanted a double tap: move 2 and if not double tap move 1
or maybe it works (does first move 1 but if you double tap you wont see that and he does move 2)
but eh one problem i guess if you press Z and hour later again it does move 2

btw i hate it when people dont look if theres already a good awnser and post a worse one

if you think someones doesnt work you say that doesnt work and then say how it should or how you would do it!

thx for the post but i wouldent say whos is the best
and thx for understanding that i am looking for a double tab code not a tap once do this and then tap again an hr l8ter
and do sumthing else
ill try all code in morning and c which 1 works till then thx all
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users