In need of help for a command
hello again evryone,
so far guys have been of great help. have question. related command sprite(spritenumber).intersects spritenumber. in last post asked how make ball bounce realisticly, idea replaced platform @ bottom of screen shooting boxes above (space invaders sort of). not familiar previous post game is: square shapes falling down top of screen , player has shoot them advance ship @ bottom of screen (ship controlled left/right mouse, shoot - lmb). detect if bullet sprite has hit box use command sprite(bulletbeinghere).intersects(boxbeindhere). command not consistent results - detects 2 sprites intersect whenever feels it. cannot recorgnise pattern, absolutely random (from point of view). attach piece of code using. please if can guide me fixing this. suspect doing wrong sprites' properties, sprites bitmaps firs 1 box, second 1 oval-shaped object, both ink:matte (from property inspector), 'merge' background. in code: custom handler detecthit, spnum number of box sprite, 11 , 12 2 bullets sprites, sprite(spnum).locv = -600 kicks out of stage box has been hit bullet, sprite(11 or 12 here).locv = 0 resets bullets in original position.
p.s. weird problem director not being able publish/compile project, working fine whilst in director, , after publishing exe file, either critical error, or background not displayed, or sprite not displayed. don't think related above problem.
thanks
so far guys have been of great help. have question. related command sprite(spritenumber).intersects spritenumber. in last post asked how make ball bounce realisticly, idea replaced platform @ bottom of screen shooting boxes above (space invaders sort of). not familiar previous post game is: square shapes falling down top of screen , player has shoot them advance ship @ bottom of screen (ship controlled left/right mouse, shoot - lmb). detect if bullet sprite has hit box use command sprite(bulletbeinghere).intersects(boxbeindhere). command not consistent results - detects 2 sprites intersect whenever feels it. cannot recorgnise pattern, absolutely random (from point of view). attach piece of code using. please if can guide me fixing this. suspect doing wrong sprites' properties, sprites bitmaps firs 1 box, second 1 oval-shaped object, both ink:matte (from property inspector), 'merge' background. in code: custom handler detecthit, spnum number of box sprite, 11 , 12 2 bullets sprites, sprite(spnum).locv = -600 kicks out of stage box has been hit bullet, sprite(11 or 12 here).locv = 0 resets bullets in original position.
p.s. weird problem director not being able publish/compile project, working fine whilst in director, , after publishing exe file, either critical error, or background not displayed, or sprite not displayed. don't think related above problem.
thanks
looks not using intersect function correctly (note: not end "s"). doesn't return boolean. returns rectangle of overlap region. if don't overlap give value of rect(0, 0, 0, 0)
newrect = arect.intersect(brect)
newrect = arect.intersect(brect)
More discussions in Director Lingo
adobe
Comments
Post a Comment