The Daily Click ::. Forums ::. Klik Coding Help ::. Pairing objects
 

Post Reply  Post Oekaki 
 

Posted By Message

alastair john jack

BANNED

Registered
  01/10/2004
Points
  294

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!VIP MemberMushroomI am an April Fool
8th December, 2009 at 01:20:18 -

Just wondering if there is a good method to do this. Such as having 42 enemies and each one has a few objects that follow it around.
It's been a while since I've used MMF2 (mainly been on construct) and I'm just wondering if there is any new ways to do it?

Or is it still the 'give every object an ID and check if they match' type thing?

 
lol

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
8th December, 2009 at 01:37:45 -

If there isn't an extension that makes this easier, there ought to be by now. It seems feasible to have a simple object that lets you pair an instance with another instance with values initially, and then use a simple "child of an instance" action.

I was almost certain something like that existed. O_o

You'll probably have to stick with the ID system. Once you get that set up initially you can probably shove it away in a behavior group and just do a the qualifying "do the values match" comparison. If you want help on that, you probably ought to bug someone like UrbanMonk.

 

  		
  		

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
8th December, 2009 at 02:09:37 -

there's a "selection object" but I've never tried it, so I don't know if this will work :/

 
n/a

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
8th December, 2009 at 14:44:49 -

If you haven't read these, they are quite useful.

How Spread Values Work: http://www.create-games.com/article.asp?id=1798
Handling Multiple Objects: http://www.create-games.com/article.asp?id=1960

 
n/a

bigredron



Registered
  07/04/2007
Points
  299
8th December, 2009 at 22:14:06 -

You know you can do it without spreading values and all that other crap.
Due to the way MMF object selection works, all you have to do is create the same ammount of parts as you have enemies.

Then simply do;
+ Always
- Set Xpos of part to Xpos of enemy
- Set Ypos of part to Ypos of enemy
- Do other stuff

This works for health bars too.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

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!
8th December, 2009 at 22:17:19 -

Thanks for that bit of info bigredron. That's a fairly new feature though if I understand correctly. At least it wasn't in the first mmf 2 build. That didn't work a few builds ago because I did something similar with object selection that worked on my computer, but didn't work for someone else who had an older build.

Make sure you have the latest build!

 
n/a

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
8th December, 2009 at 22:28:20 -

BigRedRon's method worked when I was using to pair level objects with blips on a minimap, and that was in a project about two years ago.

 
There are 10 types of people in the world: Those who understand binary and those who don't.

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

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!
8th December, 2009 at 22:36:19 -

Time travels very quickly in the click world doesn't it!

 
n/a

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
9th December, 2009 at 00:40:27 -

It does! Although I looked at my forum threads and it was only July last year x) Seems like much longer...

 
There are 10 types of people in the world: Those who understand binary and those who don't.

bigredron



Registered
  07/04/2007
Points
  299
9th December, 2009 at 23:31:29 -

This feature has been around since TGF1, and maybe even KNP.
Its the way the object selection works.
As long as you keep the same number of objects, as in you have 42 body and 42 parts, they should be aligned properly.

 
n/a

Sgamer8t88

Coding Freak

Registered
  11/09/2009
Points
  134

VIP Member
11th December, 2009 at 03:15:07 -


Originally Posted by UrbanMonk
Time travels very quickly in the click world doesn't it!




faster then we ever want to admit

 
n/a

alastair john jack

BANNED

Registered
  01/10/2004
Points
  294

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!VIP MemberMushroomI am an April Fool
18th February, 2010 at 03:46:01 -


Originally Posted by bigredron
You know you can do it without spreading values and all that other crap.
Due to the way MMF object selection works, all you have to do is create the same ammount of parts as you have enemies.

Then simply do;
+ Always
- Set Xpos of part to Xpos of enemy
- Set Ypos of part to Ypos of enemy
- Do other stuff

This works for health bars too.



That's awesome, saves a lot of Spreading and looping junk. I get it to work just fine (providing you only use the always condition).

 
lol

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
18th February, 2010 at 15:45:44 -


Originally Posted by bigredron
You know you can do it without spreading values and all that other crap.
Due to the way MMF object selection works, all you have to do is create the same ammount of parts as you have enemies.

Then simply do;
+ Always
- Set Xpos of part to Xpos of enemy
- Set Ypos of part to Ypos of enemy
- Do other stuff

This works for health bars too.



Yea lets recommend an inefficient method over an efficient one because we're lazy as hell. Using the spread alterable values method will save you a bit of future trouble. It only requires a few more lines of code and it makes everything 100x more versatile.

+Number of followers < Number of Objects
-Create Follower at (-10,-10) (or anywhere outside of the playfield, whatever you prefer)


+Number of followers > Number of Objects
+Pick one follower (you can use fastloops if you want)
-destroy follower
(you can replace this line of code by using a sort of "buffer" that tests when a specific enemy is dead so that the proper sensor/healthbar/whatever gets destroyed rather than a random one.)


+Always
- Spread 1 into Value X of Object
- Spread 1 into Value X of Object

+Compare Two General Values (Value X of follower = Value X of object)
-Set follower X Position to player X Position
-Set follower Y Position to player Y position


Edited by GamesterXIII

 
n/a

alastair john jack

BANNED

Registered
  01/10/2004
Points
  294

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!VIP MemberMushroomI am an April Fool
19th February, 2010 at 00:22:15 -

Bigredon's works fine for me, I actually find it less of a hassle, more readable, easier to work with. It depends on the situation though, the spread method is good for a lot of things, but so is this one.

Edited by alastair john jack

 
lol

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
19th February, 2010 at 16:10:38 -


Originally Posted by alastair john jack
Bigredon's works fine for me, I actually find it less of a hassle, more readable, easier to work with. It depends on the situation though, the spread method is good for a lot of things, but so is this one.



I prefer to be versatile way and I'd rather be safe than sorry.

There is a reason for everything, and being lazy can only hurt you in the end (Oh hi 99% of clickers =]). I do understand why your method works, but I refuse to take that route.



 
n/a

alastair john jack

BANNED

Registered
  01/10/2004
Points
  294

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!VIP MemberMushroomI am an April Fool
20th February, 2010 at 03:30:53 -

Fair enough :|

I'm actually using a combination of both, where appropriate. Saying it's a lazy method is like saying you should swim to Antarctica rather than taking a boat.

 
lol
   

Post Reply



 



Advertisement

Worth A Click