The Daily Click ::. Forums ::. Klik Coding Help ::. Button combos
 

Post Reply  Post Oekaki 
 

Posted By Message

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
6th June, 2005 at 21:19:48 -

Can I have button combos like in Mortal Kombat or Street fighter? I dont know how i can do this in TGF...

 
Image
http://www.kevinhaag.ca

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
6th June, 2005 at 21:52:13 -

You can use an edit object to keep track of what buttons the player has pressed.

Set up the edit object as read only and invisible. Then the following should work:

//example move: down, left, punch, kick
//we'll have a letter assigned for each button for the edit object. Down=d, Left=l,
//punch=p, and kick=k

>If press left
+set combo counter to 1
+add "l" to text of edit object

>If press right
+set combo counter to 1
+add "r" to text of edit object

//same with the rest of the buttons basically.

>If combo counter >= 1
+add 1 to combo counter

>If combo counter >=25(adjust this number according to how fast you want the player to have to press the buttons. The higher the number, the more time they have to press the next button)
+set combo counter to 0
+set text of edit object to ""

>If text of edit object = "dlpk"
+set text of edit object to ""
+insert after here whatever actually happens in the combo move itself.



I hope this makes sense.

 
n/a

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
6th June, 2005 at 22:01:59 -

Holy crap.. Thats a briliant way of doing combos... and entering cheats etc, I've been wondering how to do a good combo engine for a while now. Thanx dude, maybe i'll resume work on my fighter game....

 
Current project:
Dynabrick (%70)

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
6th June, 2005 at 22:21:06 -

hmmm, just thought of something.. what if the player has randomly pressed a whole lot of attack and move buttons and the edit object is filled with crap, and then without pause the player enters their combo... the edit object would have a whole bunch of letters in front of the combo word so it would be ignored.... Is there a way to check that the edit object ENDS in a certain peice of text??? kinda like how you can do searches for things with an * at the start to show that the start can be whatever?...

 
Current project:
Dynabrick (%70)

Crystal Clear (H.E.S)

Possibly Insane

Registered
  06/10/2002
Points
  2548
7th June, 2005 at 02:11:30 -

You could parse it, find it e.t.c there are many ways.

 
HES homepage:
http://www.distinctiv-efair.com/heretic/studios
Crystal Clear Productions: http://www.distinctiv-efair.com/heretic/crystalclear

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
7th June, 2005 at 07:53:40 -

You could probably do the following: (requires string parser 2 extension)

>when player presses button
-add that button to edit object
-set combo counter to 1
-add 1 to parser counter

>If combo counter >=1
+add 1 to combo counter

>If combo counter is >= 25
+set combo counter to 0
+set text of edit object to ""
+set parser counter to 0

>always
-set source string of String Parser 2 to text of edit object

>if midstr$("String Parser", (parser counter)-3, 4) = "dlpk"
+set text of edit object to ""
+set parser counter to 0
+combo actions inserted here.



A quick explanation about midstr$() :
Midstr$() is one of the substring functions you can use with the String Parser 2 object called midstring which can retreive text at a certain position in the string. There are 3 parameters shich work as followed:

-("String Parser", , ) this parameter you don't really need to worry about. It's just getting which string parser you're using. This will be put in automatically.

-( ,(parser counter)-3 , ) this parameter asks for where to start reading the string. In the example, we're asking it to start 4 characters behind the current position of the parser counter which we're using to keep track of our place in the object(Note though I used 3 instead of 4. We want it only 3 back so it'll count the newest character when doing the midstring check).

-( , , 4) this is the number of characters to retreive from the String Parser 2's source string starting at the value given in the last parameter.



TGF can sometimes be stupid about the String Parser 2 object. For instance, it might not add the 3rd parameter when you get the midstring function out. Then, you'll have to add it in yourself. If you're using MMF though, I've never had the problem happen to me.

 
n/a

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
7th June, 2005 at 20:20:18 -

Sounds like an interesting solution..
I have been having some trouble however with the edit object. I can't find a way of adding text to it without setting the entire text to something new, or giving it focus to type in it (can't put arrow keys in in this way). so pressing down for example, in event editor i can't find an action in the edit object that ADDS text to whats there, only stuff to replace it....
So i tried using 2 edit objets and copying the text from one (which is SET by pressing keys), and pasting into the other in order to add to the end of it... but, i couldn't get this to work either because i couldn't find a way to select the text in one in order to correctly copy it.
Maybe this is just TGF or a different Edit object, i'm not sure. Or maybe i'm just stupid, but i don't think so.

Image Edited by the Author.

 
Current project:
Dynabrick (%70)

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
8th June, 2005 at 01:43:19 -

Holy crap.
That edit box way beats the hell out of the way I've been doing cheats n stuff....

Wowee wow, wow wow... wow.

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
8th June, 2005 at 08:29:05 -

Set text of editbox1 to text of editbox1 + text of editbox2

surely you want something like that

 
n/a

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
8th June, 2005 at 08:39:17 -

you don't even need two edit boxes. To add stuff to the edit box, use the set text action and set it's text to

Edittext$( "Edit Object" ) + "(whatever letter you want here)"

The edittext$() fuction retrieves whatever text is currently in the edit box

 
n/a

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
8th June, 2005 at 09:23:06 -

Sweeeeeeeeeeeet it works, thanks heaps.
Now I can get back to my fighter game!!

 
Current project:
Dynabrick (%70)
   

Post Reply



 



Advertisement

Worth A Click