-
Notifications
You must be signed in to change notification settings - Fork 2
TexturePractice
#Load the image First, save this image to our project's asset directory
Then load it into an image handle. Don't forget to unload!
#Draw the image Draw the full sprite sheet to the screen at (320, 20)
Your application should look like this:
#Rotation variable
Make a new static variable, let's call it currentRotation intially set it to 0, rotate it 30 degrees per second.
#Robot Pieces Use the following for your bitmap source coordinates when drawing the robot assembled:
- Body: left 128, top 0, width 128, height 128
- Head: left 0, top 64, width 64, height 64
- Leg/Arm: left 64, top 0, width 64, height 64
- Bicep: left 64, top 64, width 64, height 64
- Hand: left 0, top 0, width 64, height 64
#Draw the Robot Follow the below directions to draw the robot once piece at a time. I included a screen shot with every step for a reason, this is tricky, Draw one bit, and confirm that you see it rendered as expected!
Draw the robot's body at (128,0)
Draw the robot's head at (168,31) scaled by 75%
Draw the robot's right leg at (212,85) scaled by 75%
Draw the robot's left leg at (172,85) scaled by 75% flipped horizontally (the image is flipped when scaled by a negative number, Only flip on the X axis)
Re-order the calls to the draw function to put the legs behind the body
Draw the robot's right bicep at (219,41) scaled by 75%
Draw the robot's left bicep at (165,41) scaled by 75% flipped horizontally (x axis)
Draw the robot's right arm at (224,111) scaled by 75% flipped vertically (y axis)
Draw the robot's left arm at (159,111) scaled by 75% rotated 180* around its origin
Draw the robot's right hand at (226,75) scaled by 75% rotated around its center by the variable currentRotation
Draw the robot's left hand at (157,75) scaled by 75% flipped horizontally rotated around its center by the variable currentRotation
Now your application should look like this:
The hands should be slowly rotating in opposite directions.


