dMZX Forums: Reguarding Sprite Collision - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Reguarding Sprite Collision I want to make sure I understand it.

#1 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 06 January 2015 - 06:30 AM

Hey all, I'm hoping some one can give me information regarding how sprite collision is checked. I'm working on a (multi-part) tutorial about sprites and I want to be thorough in explaining how it works so those using it are successful. I may learn some more about it as well.

As near as I can tell, when the command (IF c?? sprite_colliding pNN x y "collision") is used then the counters (SPR_CLISTn) and (SPR_COLLISIONS) are set and remain valid only while the current robot on board is executing its code, correct? In other words, when another robot wants to check for collision, it will need to use the command as well, because the counters that were set by the previous use of the command are now invalid. So if this is correct than the two counters above can change as many times per cycle as there are robots on board?

Thanks for any info you are able to give me. :(
Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

#2 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 06 January 2015 - 06:36 AM

the counters are set when sprite_colliding is checked. this can happen any number of times. the robot that does the checking does not matter. it is only important that the checking code happen atomically if you have robots on the board doing sprite collision checks, so the robot that is busy checking the counters is not pre-empted by another robot that then does if sprite_colliding causing the counters to change. increase the "commands" counter as necessary to ensure this atomicity.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#3 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 06 January 2015 - 07:00 AM

View PostLancer-X, on 05 January 2015 - 10:36 PM, said:

the counters are set when sprite_colliding is checked. this can happen any number of times. the robot that does the checking does not matter. it is only important that the checking code happen atomically if you have robots on the board doing sprite collision checks, so the robot that is busy checking the counters is not pre-empted by another robot that then does if sprite_colliding causing the counters to change. increase the "commands" counter as necessary to ensure this atomicity.


Thank you for the prompt reply Lancer. So each robot on board get it's turn executing code (or each robot is scanned and it's code executed), starting with the global and then one nearest to 0 0, continuing across the boards X coordinates, then increasing the y coordinate and checking across the X coordinate again, until the highest X Y coordinate on board has been reached, right? and each robot that executes code will continue to do so until a cycle ending command is reached, or the robot executes a number of commands equal to the "commands" counter. Am I understanding that correctly?
Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

#4 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 06 January 2015 - 07:14 AM

yes, mostly. there's also a reverse scan that can happen and really confuse things. some details in this thread. you typically don't need to worry about it until you suddenly do.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#5 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 06 January 2015 - 09:12 AM

Quote

This might seem odd, but what it actually does is sets COMMANDS to the highest possible integer value in MegaZeux, 2 147 483 648. You. Will never. Need. This many commands. Don't use this.


bmpconverter said:

set "COMMANDS" to "(-1>>1)"


ah dammit :(
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#6 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 06 January 2015 - 02:32 PM

View PostLachesis, on 06 January 2015 - 01:12 AM, said:

ah dammit :(


Huh?!?! :-0
Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users