Download presentation
Presentation is loading. Please wait.
Published byEleanor Neal Modified over 9 years ago
1
Motion 3. Motion Block Motion blocks allow you to program the Sprite’s movement. You can move it to different location, rotate, move towards the mouse or specify what you want the spike to do when it touched the edge of the stage.
2
You will learn … Make the Sprite move X, Y co-ordinates
Move in position / # of steps Turn the Sprite Point towards mouse Touch the edge Display X, Y, direction Event Block
3
Display information on stage
Motion Block Set turning behavior Go to a location Touch the edge Point to a direction Display information on stage Set/change X,Y position Move steps Turning an angle Motion Block
4
What is x, y ? Position a Sprite Specific Position - +
Positive X Positive Y Negative X Negative Y + - Specific Position The x,y position is (0,0) at the centre of the stage. Right most is 240, left most is Up most is 180 and the down most is -180 Motion Block
5
Time to Reach a Position
goToXY.sb2 You can program the movement to a specific position in number of second. This will slow down the movement of the spike Motion Block
6
Time to Reach a Position
Video goToXY.sb2 Video Clip Motion Block
7
Define / set x,y = 0,0 Position
In Costumes tab, Vector mode , Move the Cross to the Sprite to define the (X,Y)=(0,0) position Zeroing at centre position is done by the Zeroing tool. This will set the location of the Spite at X,Y = 0,0 . This is important as a reference so that You X,Y programming location can be accurate and predictable. Motion Block
8
Angular Position How ? Turn 0 to 360 deg or 0 to -360 degree 0 deg
Motion Block
9
Angular Position Add the “set rotation style …” to position the Sprite correctly . init_Sptire_To_Specific location.sb2 Motion Block
10
Touching Edge at 90 Degree
Video MoveTouchEdgeCatSprite.sb2 Video Clip Motion Block
11
Touching Edge at Any Angle
Opposite any angle Use Sensing block and add another 180 deg to direction Rebound when touches edges : top, bottom, right , left Press Key “1” Motion Block
12
Touching Edge at Any Angle
No rebound, stuck inside an edge depending on the starting angle Press Key “Space” Rebounded but stuck at the top edge as the Sprite still touches the top edge. Press Key “2” Move away from the edge Motion Block
13
Touching Edge at Any Angle
Rebound correctly done Press Key “3” MotionBock_cat_angleTurn180.sb2 Video MotionBock_cat_angleTurn180.sb2 Video Clip Motion Block
14
Point at PC Mouse Point at Mouse – not moving Move towards the Mouse
crab_move_towards_PC_mouse.sb2 This simple program make the crap move/turn depending on the movement of your mouse. Motion Block
15
Point at PC Mouse Video crab_move_towards_PC_mouse.sb2 Video Clip
Motion Block
16
Motion End of Motion Block
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.