The Daily Click ::. Forums ::. Klik Coding Help ::. The picking object bug/law
 

Post Reply  Post Oekaki 
 

Posted By Message

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
8th June, 2008 at 23:18:42 -

I don't know what you call it but it's that usual bug where when you do
When A overlaps B, XPosition("B")=XPosition("B")+XPosition("A")

it moves all the B objects or moves it according to the position of the latest A object. I think you guys know what I mean.

The question is, how the hell do I get rid of that? The classic solution is to add a Pick Y at random, but that doesn't work with timed events. Any other solutions?

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
8th June, 2008 at 23:38:20 -

I think the problem is that it is only narrowing down the selection list of the A & B objects for ONE of the two involved in the "A is overlapping B", not both. This should ALWAYS be either the first one or second one, don't remember which.

So it might be like if you put
"A is overlapping B"

All events would reference only the B object thats overlapping, while referencing ALL A objects still.


I guess the best workaround would be to have your movement triggered so that instead of moving all your objects in the same frame, you run a loop that iterates through them, and chooses a single A & checks it for collision with B, hence narrowing the selection to a single A & B
So instead of doing:

+Always

=Set Pos(A) to (Pos(A)+Velocity(A))

+A is overlapping B
=Set Pos(B) to (Pos(B)+Pos(A))


You could instead do something along the lines of:

+Always

=Set A Flag 0 off
=Set A Flag 1 off
=Start Loop "Safe Movement" for (# of A objects) Loops

+On Loop Trigger "Safe Movement"
+A Flag 0 is off
+Pick an A at Random
=Set A Flag 0 On
=Set A Flag 1 On

+On Loop Trigger "Safe Movement"
+A Flag 1 is On
+A is overlapping B
=Set Pos(B) to (Pos(B)+Pos(A))

+On Loop Trigger "Safe Movement"
+A Flag 1 is On
=Set A Flag 1 Off


 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
15th June, 2008 at 20:21:03 -

Hey, that works! Lol, I've been placing that liberally and it's fixed almost every bug in my game. I commented it as the "pixelthief code" for lack of a better name (and as a small acknowledgement to your help). Lol, nothing better than having a theorem, a piece of code, or an engine named after you

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Roseweave



Registered
  31/07/2007
Points
  341
16th June, 2008 at 07:13:02 -

Oh I know what you mean. They really need to improve the "Pick Object" code. Picking objects within a certain area just isn't enough.

 
Check out my Telekinesis'em'up Thread and the ALICE Machines -

http://www.create-games.com/project.asp?id=1213

"Did you know there's a million bucks hidden in the house next door?"
"But there is no house next door?"
"No? Then let's go build one!"

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
19th June, 2008 at 20:48:39 -

And qualifiers. I had a "damn this code!" fit last night, only to realise that MMF was randomly activating a flag for a qualifier which I didn't tell it to touch. I used flag 7777 and 7778 per code above for Group.Enemies and Group.Friends, both of which are never the same thing, but for some reason, when I activate the flag for Group.Enemies, it also activates the flag for half of Group.Friends!

So after another hour wasted noticing the bug, swearing at the computer, and trying random things to workaround MMF2's built-in qualifier bug, I found out that I could fix it by using flag 7779 and 8000 for Group.Enemies instead. Good thing MMF has unlimited flags

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
20th June, 2008 at 02:31:50 -

Muz... It doesn't... It has 32...

33 is 0
34 is 1
35 is 2

So on and so forth.

 
Image
http://bfollington.tumblr.com

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
20th June, 2008 at 02:57:35 -

Crud. That explains a lot.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Roseweave



Registered
  31/07/2007
Points
  341
20th June, 2008 at 05:50:40 -

32 flags really isn't enough. They haven't improved it since TGF.

 
Check out my Telekinesis'em'up Thread and the ALICE Machines -

http://www.create-games.com/project.asp?id=1213

"Did you know there's a million bucks hidden in the house next door?"
"But there is no house next door?"
"No? Then let's go build one!"

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
20th June, 2008 at 06:58:25 -

Jamie posted some code for converting one alterable value into 32 more flags on the Clickteam forums a while back, it used bitwise operations I think...

 
Image
http://bfollington.tumblr.com

Roseweave



Registered
  31/07/2007
Points
  341
20th June, 2008 at 07:08:02 -

I often tend to use Alterable Values instead of flags.

Like for instance instead of having a flag set on for a value to count to 30, I'll just set it to one, and then have code for it to increment when only 1 or above. It works quite well, less messy than using loads of flags.

Also, Muz, have you tried the Select Object extension?

 
Check out my Telekinesis'em'up Thread and the ALICE Machines -

http://www.create-games.com/project.asp?id=1213

"Did you know there's a million bucks hidden in the house next door?"
"But there is no house next door?"
"No? Then let's go build one!"

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
23rd June, 2008 at 19:43:11 -

There's a select object extension? Lol, there's so many extensions out there I haven't really bothered to look at all of them. Thanks!

Oh, there's also a flag object extension for those who feel the need to use several flags. I somehow assumed since the flag objects can support practically limitless flags, MMF should have the same feature built in..

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
23rd June, 2008 at 21:32:41 -


Originally Posted by Muz
There's a select object extension? Lol, there's so many extensions out there I haven't really bothered to look at all of them. Thanks!

Oh, there's also a flag object extension for those who feel the need to use several flags. I somehow assumed since the flag objects can support practically limitless flags, MMF should have the same feature built in..



Go ask them about it on the forums, they'll probably add it in a future release .

 
Image
http://bfollington.tumblr.com
   

Post Reply



 



Advertisement

Worth A Click