How can i get the nackground of my project to change colour depending on the distance of the point on the stage and a sprite that moves during the simulation or game etc.? I thought of creating about 200 square sprites and placing them all over the stage acting as a background but this looks pixelated and takes along time to place to get it looking good. Is there a more efficent way os doing this?
Offline
Try using the color effect:
change [color v] effect by (25) set [color v] effect to (25)
Offline
If you are trying distance to x: y:
([sqrt v] of ((((x position) - (position on screen x)) * ((x position) - (position on screen x))) + (((y position) - (position on screen y)) * ((y position) - (position on screen y)))))
Last edited by chanmanpartyman (2012-04-17 20:47:46)
Offline
Well, unfortunately there's not a super fast way to do it, but I thought of a way that might be less tedious than your current solution. Instead of changing the colors of sprites, you could have one sprite that uses pen to draw the background. In turbo-mode, it works pretty quickly. Maybe this or a variation could do the trick.
when I receive [Change Background v] //this can be whatever triggers your background change clear go to x: (-240) y: (180) //start in the upper left-hand corner repeat (360) //the 2 repeats cycle through every x,y position on the stage. Outer is going down, inner is across repeat (480) //go across until it gets to the end set pen color to (distance to [Sprite1 v]) pen down //color the pixel pen up change x by (1) //move 1 to the right end set x to (-240) //now go back to the left end change y by (-1) //and down 1 row end
Last edited by scmb1 (2012-04-17 22:55:51)
Offline