The Daily Click ::. Forums ::. Klik Coding Help ::. Underscoring?
 

Post Reply  Post Oekaki 
 

Posted By Message

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
14th June, 2010 at 19:57:43 -

I've decided to take a break from Cameo Combat to work on a small new game, possibly for the arcade, just for fun. Also, I remembered that if I finished it I could get my rating back.

But I has a small problem. When an enemy's alterable value A (health) <= 0 it adds 25 to the player's score. I have 16 pre-spawned enemies that altogether if destroyed, WOULD make 400 points. 16 x 25 = 400. I say "would" because the score doesn't always add up. The enemies tend to be destroyed around the same time as other enemies, resulting in a total score that's under the calculated score. (E.g: I've destroyed all 16 enemies. The problem is I got 350 added to the score, or 375, or 325, or 300, but almost never 400.)

I have no clue what's wrong. Is there some way to make sure MMF2 calculates the exact points recieved for destroying enemies?

Thanks in advance!

 
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
14th June, 2010 at 20:06:31 -

Try adding an extra step:

Health Value = 0
+Counted Value = 0
>>Set Counted Value to 1
+ Add 25 to score

 

  		
  		

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
14th June, 2010 at 20:27:37 -

I'm not sure I entirely get what you mean. Do you mean that Counted Value could be, say, Alterable value B or such? If so, that didn't work.

 
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
14th June, 2010 at 20:33:11 -

Pick one of?

Do the enemies get destroyed or just lay on the ground?

 

  		
  		

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
14th June, 2010 at 20:34:33 -

The enemies get destroyed. Let me see if "Pick one of" works...

 
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
14th June, 2010 at 20:36:16 -

Make sure it's below the one that compares the health value to 0.

 

  		
  		

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
14th June, 2010 at 20:38:00 -

Either an alterable value, or just a flag should do.
And make sure you put the "Destroy Enemy" action at the end of that event.
That should fix the problem if it's caused by multiple enemies being destroyed in the same frame.

Or try:

+ Health("Enemy") = 0
+ Pick one of "Enemy"
-> Add 25 to "Score"
-> Destroy "Enemy"

EDIT: You were too quick

Edited by Sketchy

 
n/a

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
14th June, 2010 at 20:47:36 -

Dang, those didn't work either. :| I'll specify abit more...

When an enemy is destroyed, is leaves debris behind, which, if it hits another enemy, subtracts 1 from that enemy's health. This causes a huge chain reaction which tends to destroy multiple enemies at once.


 
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
14th June, 2010 at 21:04:26 -

That is quite odd indeed. O_o Are you too far along on this project to share the source?

 

  		
  		

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
14th June, 2010 at 22:37:38 -

Oh I know this problem. It's really annoying.
On an event that applies to multiple objects, the actions are only applied once (even though all object are destroyed properly).
If you really want to be sure that your score is counted correctly, you have to loop through all your enemies and check for each object whether it's health is 0 and then add the score.

So:

+The event where the enemies health is subtracted
-> start loop "destroy" number of enemy times

+On loop destroy
-Enemy's health <=0
-> destroy enemy
-> add score

 
This space is for rent

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
15th June, 2010 at 00:56:22 -

I tried your method, Hernan- it sort of works, but it actually adds more than necessary. Weird...

Here's an mfa. http://www.mediafire.com/?jjrfz4ygd5n

Edit: Oh yeah, sorry for the filesize, it's the alpha channels...

Edit Edit: Oh snap! I posted the wrong mfa which was an earlier build. *facepalm* Updated the link.

Edited by W3R3W00F

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
15th June, 2010 at 11:26:39 -

I tried, but it's giving me an error with "joystick2.mfx"
I already had that extension, but I just updated it with the Fusion Updater, and still no luck.

If you strip out all references to the joystick extension, I could give it another go, although I still can't guarantee I'd be able to fix your problem...

 
n/a

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
15th June, 2010 at 13:31:44 -

sketchy, i had the same issue with someone else's mfa and joystick2. update directx and it will resolve this issue!

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
15th June, 2010 at 15:59:59 -

Lembi:
Thanks - that did the trick

W3R3W00F:
Okay, I've finally managed to open your file
There are actually two problems I've found:

1.) As you said, sometimes two or more enemies are destroyed during the same frame, while the score is only increased once. That's easily fixed by using "pick one of" when destroying the enemies (get rid of all that fastloop stuff).
I edited your file, but I had to do it in the non-HWA version of MMF2 (kept crashing in HWA).
http://cid-b1e7ee094271bbda.office.live.com/self.aspx/Public/A%20turret%20game%20EDIT.mfa

2.) If you use a counter to keep track of the number of enemies remaining, you will see that sometimes enemies are somehow(?) leaving the game area without being destroyed. In that situation, you think you've destroyed all the enemies because you can't see any, but really you haven't, which is why your score is under 400.

 
n/a

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
15th June, 2010 at 21:27:39 -

Perfect, did the trick! Thanks, Sketchy. I fixed the crashing problem by copying and pasting both frames into a new project, and saving it.

Thanks a million to all who replied! Much appreciated.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click