The Daily Click ::. Forums ::. Klik Coding Help ::. Need help making a fighting game in Multimedia fusion 2
 

Post Reply  Post Oekaki 
 

Posted By Message

ig299



Registered
  27/10/2014 04:34:16
Points
  230
24th January, 2015 at 24/01/2015 05:04:16 -

Hello, I know how to make it so it picks the opponent your fighting at random but how do you make it so that you don't fight the same opponent twice in Multimedia fusion 2?

 
111111games

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th January, 2015 at 24/01/2015 19:03:43 -

Hey there!

It'll be easier for us to give you the best answer if we have a few more details about how you have your project set up. Are you creating objects to fight the next opponent? Jumping to another frame? Picking one of an object group at random?

Most likely, if you're using Random() to create a number that corresponds to the next opponent, it'll be as easy as setting an alterable or global value somewhere to the last one generated. Then you'll compare the value of the next random number to that value before spawning/jumping to the next opponent.

 

  		
  		

ig299



Registered
  27/10/2014 04:34:16
Points
  230
24th January, 2015 at 24/01/2015 22:29:45 -

I was planing on doing this if a counter = 0 fright this opponent if counter = 1 fight this opponent and so forth

 
111111games

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th January, 2015 at 24/01/2015 23:48:19 -

This may not be the most elegant way to do it, but it's one solution.

I often like to have an active object sitting off-screen that I call a Value Box, just so I can use it for storing alterable values and flags without cluttering up my global values. Here's an example, where the green diamond is my value box:

Image

1. I spawn the next enemy with each press of the spacebar (you can substitute whatever firing event you want). I set the value box's flag 0 on--we'll say that means search mode is on. It also sets alterable value A to a random number.

2. If the value is the same as the current counter value, it generates another random number.

3. If it's different from the current value, it sets the counter to that number and turns off search mode, flag 0.

 

  		
  		

ig299



Registered
  27/10/2014 04:34:16
Points
  230
25th January, 2015 at 25/01/2015 02:41:59 -

Thank you but i am still confused. Could you maybe make a video tutorial of what you just shown in a case of fighting game?

 
111111games

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
26th January, 2015 at 26/01/2015 11:16:00 -

The Random Pool object would work for this I believe. It allows you to select a number from a pool of numbers and then remove that number from further use.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
26th January, 2015 at 26/01/2015 15:05:07 -

You can create a fighting game any number of ways, so I'm not sure I can change the specifics in any way that would be helpful without knowing more about your setup.

Looking at the event list I showed you, would you be able to recreate each line? I know big old lists can be overwhelming taken as a whole.

Basically, I've just introduced a second counter into the mix; it's in a different form so I can also use a flag, which counters don't have. If the second counter creates a number different from the first counter, it gets used!

 

  		
  		

ig299



Registered
  27/10/2014 04:34:16
Points
  230
27th January, 2015 at 27/01/2015 20:08:47 -

Could I use a run event once for each number of the counter?

 
111111games

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
28th January, 2015 at 28/01/2015 21:40:12 -

You could use a hidden list box and then remove numbers as they get selected.

 
n/a

ig299



Registered
  27/10/2014 04:34:16
Points
  230
29th January, 2015 at 29/01/2015 03:07:11 -

Where do i find that hidden list box is it an object?

 
111111games

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
29th January, 2015 at 29/01/2015 14:14:33 -

It's just the list box but placed outside of the viewable frame

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
29th January, 2015 at 29/01/2015 15:24:12 -

Ah! I misunderstood. I thought you just didn't want the same enemy twice in a row. Yes, do a list object.

 

  		
  		

ig299



Registered
  27/10/2014 04:34:16
Points
  230
1st February, 2015 at 01/02/2015 01:04:17 -

Can you give me a demonstration of how to use that list box?


 
111111games

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
3rd February, 2015 at 03/02/2015 18:04:03 -

Use the random multipool object instead.
http://community.clickteam.com/attachment.php?attachmentid=4064&d=1276366991#?Random%20Multipool%201.2.1.zip

Random Multipool won't require that you use complicated Str$ and Val conversions when dealing with numbers in a list object. Besides, by the time you're done developing all your fighters, having a bunch of visual objects that force screen update will probably have a negative effect on overall game performance.

Create your Random Multipool object and 1 Active Object.

Start of Frame:
Random Multipool -> Set limits of pool "Fighters" to (1-10).
Random Multipool -> Fill pool "Fighters".
*This assumes you have 10 fighters.

Upon pressing "Space Bar":
Random Multipool -> Generate number from pool "Fighters".
Active Object -> Set Alterable Value A to Last Generated Number ("Random Multipool","Fighters")
Random Multipool -> Remove all occurrences of number Alterable Value A("Active Object") from pool "Fighters".
*Upon pressing the space bar, a random number is picked out of the pool, stored in your Active Object's Alterable Value A, then that number is removed from the pool so it's never picked again.

Add a counter to the frame if you want to see this work. You'll need to add an extra event, too. In the "Upon pressing space bar" event, add "Set counter to Alterable Value A ("Active Object"). Whether you can see this work or not, it'll pick a random number out of the pool every time you press the space bar - and it'll never pick the same number twice before exhausting the whole pool.


 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?

ig299



Registered
  27/10/2014 04:34:16
Points
  230
3rd February, 2015 at 03/02/2015 21:56:44 -

thanks


 
111111games
   

Post Reply



 



Advertisement

Worth A Click