(0-360 degrees) of the fling, as well as the x velocity and y velocityĬomponents of the fling’s vector. Also provides the speed (pixels per millisecond) and heading The (x,y) position of the start of the fling, relative to the upper Flung( x, y, speed, heading, xvel, yvel) When a fling gesture (quick swipe) is made on the sprite: provides Edge here is represented as an integer that indicates one of eightĭirections north(1), northeast(2), east(3), southeast(4), south (-1), southwest(-2), west(-3),Īnd northwest(-4). If Bounce is then called with that edge, the sprite will appear to bounce off EdgeReached( edge) Event handler called when the Ball reaches an edge of the screen. Note that the Ball won’t actually moveĪnywhere in response to the Dragged event unless
Starting coordinates subsequently, they are the “current” coordinatesįrom the prior call. Within a given drag, the “previous” coordinates are the same as the On all calls, the starting coordinatesĪre where the screen was first touched, and the “current” coordinatesĭescribe the endpoint of the current line segment. Dragged( startX, startY, prevX, prevY, currentX, currentY) Event handler for Dragged events. Therefore, collisionĬhecking will be inaccurate for tall narrow or short wide sprites that are Note that checking for collisions with a rotated ImageSprite currentlyĬhecks against its unrotated position. Events CollidedWith( other) Event handler called when two enabled sprites ( Balls or ImageSprites)Ĭollide. Z How the Ball should be layered relative to other Balls and ImageSprites, with higher-numbered layers in front of lower-numbered layers. Otherwise, it is for the uppermost point of the Ball. OriginAtCenter is true, the coordinate is for the center of the Ball Y The vertical coordinate of the Ball, increasing as the Ball moves down. Otherwise, it is for the leftmost point of the Ball. X The horizontal coordinate of the Ball, increasing as the Ball moves right. Visible Sets whether sprite should be visible. Interval milliseconds if Enabled is true. Radius The distance from the center of the Ball to its edge. ( true) or its left and top edges ( false). OriginAtCenter Whether the x- and y-coordinates should represent the center of the Ball Interval is 50 and the Speed is 10, then the Ball will move 10 pixelsĮvery 50 milliseconds. Interval The interval in milliseconds at which the Ball’s position is updated. Of the screen 90 degrees is toward the top of the screen.
Heading The Ball’s heading in degrees above the positive x-axis. Properties Enabled Controls whether the Ball moves when its speed is non-zero. The difference between a Ball and an ImageSprite is that the latter can get its appearanceįrom an image file, while a Ball’s appearance can only be changed by varying its
Other properties can be changed at any time. Interval property to 500, the Heading property toĩ0, and the Enabled property to true. (half second), you would set the Speed property to 4, the
Interact with other sprites ( ImageSprites and other Balls) and the edge of theĬanvas, and move according to its property values.įor example, to have a Ball move 4 pixels toward the top of a Canvas every 500 milliseconds A round ‘sprite’ that can be placed on a Canvas, where it can react to touches and drags,