The Daily Click ::. Forums ::. Klik Coding Help ::. Pinball Movement Problem?
 

Post Reply  Post Oekaki 
 

Posted By Message

J.C



Registered
  22/03/2013 05:18:14
Points
  118
6th October, 2015 at 06/10/2015 05:33:43 -

Hi. Got another roadblock in my coding here.

I have just implemented the pinball movement for a bouncing coin/treasure/collectible item in my game. I wanted the gems to have multiple colors so I made separate sprites for each of them. But I'm having this problem where they stop in midair after bouncing once or twice instead of bouncing on the ground until the decelerate enough to stop.

Is using a qualifier for an effect like this a bad idea? Somehow I think that might be the reason for this issue, though it really shouldn't be.

Any ideas?

Mfa file provided below for your convenience.

https://www.dropbox.com/s/9x1vg13o946nko5/Bouncing%20Items%20test.mfa?dl=0

 
n/a

J.C



Registered
  22/03/2013 05:18:14
Points
  118
7th October, 2015 at 07/10/2015 16:44:56 -

Ok. I've found a solution!

Turns out using a qualifier kind of bugged the code for some wierd reason, not sure why. But the workaround was to create the bounce code for each coin, and it worked!

No idea why a qualifier caused it to bug out like that though. Any ideas?

 
n/a

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!
7th October, 2015 at 07/10/2015 17:01:41 -

Here's the solution.
Swap the conditions. (I changed the min speed to 20 since it looks better)

Image

The reason this works is because of the way Fusion decides what objects to select.
Conditions that have black text apply to all objects of that type even if only one matches the condition.
Conditions in green or red apply to only objects that match that specific condition.

In order to make this work we need to make the collision condition last so it'll only apply to those objects colliding.

This is called object scope.

Here's what happens

Speed of "Object" < 20
-The text is black so any action called will apply to all objects of that type
Collides with the Background
-The text is red so it'll only apply to objects of that type that satisfy the condition. We narrowed it down.

If you put them in the other order the second condition will override the first and select all objects of that type again.

Edit: Spelling

Edited by UrbanMonk

 
n/a

J.C



Registered
  22/03/2013 05:18:14
Points
  118
7th October, 2015 at 07/10/2015 21:09:48 -


Originally Posted by -UrbanMonk-
Here's the solution.
Swap the conditions. (I changed the min speed to 20 since it looks better)

Image

The reason this works is because of the way Fusion decides what objects to select.
Conditions that have black text apply to all objects of that type even if only one matches the condition.
Conditions in green or red apply to only objects that match that specific condition.

In order to make this work we need to make the collision condition last so it'll only apply to those objects colliding.

This is called object scope.

Here's what happens

Speed of "Object" < 20
-The text is black so any action called will apply to all objects of that type
Collides with the Background
-The text is red so it'll only apply to objects of that type that satisfy the condition. We narrowed it down.

If you put them in the other order the second condition will override the first and select all objects of that type again.



Wow, thanks UrbanMonk! It worked.

Now, there is another strange issue I noticed, when the player is moving while the gems are bouncing, they just seem to keep on bouncing forever unless the player stands still. Any reason why this is happening? Maybe it has something to do with the pinball movement?

 
n/a

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!
9th October, 2015 at 09/10/2015 16:37:36 -

Hmm that's weird. Just tried it. I fact it looks like the gems gain height whenever you move.
I'll see if I can track down the issue.

 
n/a

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!
9th October, 2015 at 09/10/2015 17:00:33 -

Ok so I found a hacky solution. It seems there is a bug in the pinball movement that causes it to behave differently when the screen is scrolling. Now personally I don't use the built-in movements because of this very reason, but instead of writing a custom movement for you I just patched this one. IT's not a perfect fix, but it's better than nothing.

Also I wanted to correct something I said earlier about object scope. Turns out I was wrong about the color thing. The red/green conditions doesn't mean that they'll select one object of a particular type after all, they actually mean that if they come first in a condition list that they'll be processed as soon as an event occurs ahead of all the other events in the event list.

Anyway it is true that some events apply to objects individually rather than all objects of a particular type. For example doing comparisons to object's Alterable Variables will apply only to the objects that meet the criteria.

With all that said here's what I did to minimize the bounce issue. IT doesn't remove it completely, but it's better than it was:

Image

 
n/a

J.C



Registered
  22/03/2013 05:18:14
Points
  118
10th October, 2015 at 10/10/2015 00:59:06 -

Thanks again UrbanMonk! That solution works a heck of a lot better. Thanks so much for your help man. I really appreciate it.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click