Skip to content
Gabor Szauer edited this page Aug 18, 2015 · 3 revisions

#Load the image First, save this image to our project's asset directory

ROBO-FULL

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:

Checkpoint1

#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)

1

Draw the robot's head at (168,31) scaled by 75%

2

Draw the robot's right leg at (212,85) scaled by 75%

3

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)

4

Re-order the calls to the draw function to put the legs behind the body

5

Draw the robot's right bicep at (219,41) scaled by 75%

6

Draw the robot's left bicep at (165,41) scaled by 75% flipped horizontally (x axis)

7

Draw the robot's right arm at (224,111) scaled by 75% flipped vertically (y axis)

8

Draw the robot's left arm at (159,111) scaled by 75% rotated 180* around its origin

9

Draw the robot's right hand at (226,75) scaled by 75% rotated around its center by the variable currentRotation

10

Draw the robot's left hand at (157,75) scaled by 75% flipped horizontally rotated around its center by the variable currentRotation

11

Now your application should look like this:

checkpoint2

The hands should be slowly rotating in opposite directions.

Clone this wiki locally