Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var numCandles = readInt("How old are you? ");
- var candleWidth = 15;
- var candleHeight = getWidth()/5;
- for(var i = 1; i< numCandles + 1; i++){
- var candle = new Rectangle(candleWidth, candleHeight);
- candle.setColor(Color.red);
- if(i%2 == 0){
- candle.setPosition(getWidth()/2-candleWidth*i, getHeight()/3 - candleHeight);
- }else{
- candle.setPosition(getWidth()/2+candleWidth*i, getHeight()/3 - candleHeight);
- }
- add(candle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement