Modifying loops

Onke's modified loop

Onke’s modified loop – source code

How do you think Onke managed to start the loop further to the right? He did it by changing parameters of the function, like this:

  //use for loop to draw series of pacmans across the screen
for(x3=0;x3<width;x3+=radius){
  pacman(x3+100, y3+30,luhlaza, false, radius, 1);  
  }

Can you think of another way that he could have done it?

Talita's modified function

Talita’s modified function –source code

Lisa changes size and background colours

Lisa changes size and background colours – source code

Mfuneko's pacman disappears

Mfuneko’s pacman disappears – can you see why in the source code?

Advertisements

One thought on “Modifying loops

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s