The Daily Click ::. Forums ::. Klik Coding Help ::. Shadows for Enemies
 

Post Reply  Post Oekaki 
 

Posted By Message

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
13th July, 2006 at 08:32:45 -

"See my last post. That does work thanks to some sort of magic, but it can get confused and there's no guaranteed way to manage destructions."


I think Radix' description of it as 'some sort of magic' is probably quite accurate, lol. I'm not certain, but I have a feeling that object pairing in MMF is a quirk of the Runtime rather than an intended feature.

MMF seems to handle objects in the order they were created, with older objects being processed first. This applies to events, but it also applies to the Spread Value routine. They're indexed according to the same basis.

The result is that if you spread values in two objects and then tell those objects to follow each other, the objects with the same spread values will naturally line up.

I've personally never found a problem with MMF's auto allocation, but I don't doubt there are some. This IS mmf we're talking about after all!


My favourite method for doing the shadiw thing would just be to spread a value so that they have ID numbers. Then use a simple Always event to auto-position them. When an object dies, select the shadow with the same ID and kill that too. If an object is created, create a shadow as well. At the start, use a fastloop to make sure that the number of shadows is equal to the number of enemies (fastloop prevents a momentary delay at the start).

That's the way I do it, and it's never gone wrong for me.

Since MMF auto-positions objects, you CAN do this without Spread values. Just delete any old shadow (using the 'pick at random...' condition to make sure you only delete one of them, not all). MMF will reposition them again. But this leaves a visible flicker as MMF re-sorts the objects, so it's not recommended.

 
191 / 9999 * 7 + 191 * 7

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
13th July, 2006 at 12:43:18 -

ah, i would have seen your post Radix, but for some reason i was looking at only the first page, not all of them like i usually do.

 
.

Werbad



Registered
  18/09/2002
Points
  235
13th July, 2006 at 18:28:49 -

the "auto allocation" is one of the few things in MMF that is actually working (unless you're completley worthless)
I have never had any problems that I haven't been able to solve using this...

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
13th July, 2006 at 22:18:06 -

It's bad coding practice. Don't do it. Or at least don't tell other people to do it. End story.

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
14th July, 2006 at 07:32:06 -

-_-...
ラヂクスは本当にお馬鹿さんですね。。。

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th July, 2006 at 08:41:42 -

Yes, we've all got access to machine translations. If you had anything worth saying you wouldn't do so in moonspeak, coward.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
14th July, 2006 at 11:43:59 -

Well, there are going to be a lot of active objects in the game in general (land objects like trees, bushes, water sources and etc. I'm glad they give you a 10,000 active limit- I hope I don't use half of it though!

So far, all enemies are going to be created when your invisible line of sight collides with an invisible active picture named "encounter". Then a random enemy is created on that spot. So far, all I've done is ground enemies. There will still be flying enemies, but I may have them on the frame beforehand. Since the ground enemies so far all have an appearing animation of them crawling out of the dirt, creating them this way seems to work, and they don't need a shadow.

Okay, so I was messing around with the spread values last night a bit, and I have a question about it. You have the option to Spread a Value to an active's alterable variable, right? Now if you want to assign it an incrementing ID#, what's the best way to do this? A counter? Oh, and yes the shadows all have semi-transparency to make them look better, and 3 frames of animation where they grow and shrink depending on the relative altitude of the flying creature (in the case I have now, a bat).

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
14th July, 2006 at 13:36:25 -

Errr...guys.

Always - Destroy Shadow.
Always - Shoot Shadow at speed 0
Always - Bring shadow to back


 
Craps, I'm an old man!

Werbad



Registered
  18/09/2002
Points
  235
14th July, 2006 at 13:39:59 -

We all got translators, I know japanese
there is a slight difference
Anyways, there has been posted quite alot of examples, use whichever one you feel like...

 
n/a

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
15th July, 2006 at 23:07:47 -

"Okay, so I was messing around with the spread values last night a bit, and I have a question about it. You have the option to Spread a Value to an active's alterable variable, right? Now if you want to assign it an incrementing ID#, what's the best way to do this? A counter? Oh, and yes the shadows all have semi-transparency to make them look better, and 3 frames of animation where they grow and shrink depending on the relative altitude of the flying creature (in the case I have now, a bat)."

Spreading a Value should give your objects an incremental ID, unless I'm misunderstanding your question.
Also, I've had a lot of problems with MMF auto-allocation, epescially with shadows.

 
http://www.klik-me.com
   

Post Reply



 



Advertisement

Worth A Click