This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

myheartwillgoon
myheartwillgoon presents ...

2013/1/19

piano-my project

A very simple piano game I have made by help of the greenfoot book

5797 views / 634 in the last 7 days

Tags: with-source

open in greenfoot
Your browser does not support the canvas tag.
danpostdanpost

2013/1/19

We are wanting the keys to be horizontally centered in the world. The center of the world is at half the width of the world. Half the keyboard is to be on the left of world center and the other half on the right. The whole keyboard width is the number of keys times the width of the image of one key; half of that is the number of keys times the width of the image of one key divided by two. Subtracting half the width of the keyboard from the center of the world gives the location of the left edge of the first key of the keyboard. Adding half the width of one key to that will give the x-location at which to place the first key. The remaining keys can then be placed by adding the width of one key to the x-location of the last key placed.
A new version of this scenario was uploaded on Sun Jan 20 14:58:29 UTC 2013 A very simple piano project I have done with the help of book.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.