text size code.org app design code example

Example: set property of undefined code.org

var background = createSprite(0, 0 ,400, 400);
background.setAnimation("sunshine_showers_1");
background.scale = 2;
background.x = background.width/2;


var bow = createSprite(380, 200,20,70);
bow.setAnimation("bow");
textSize(20);
textFont("Georgia");
var arrowGroup;
function redBalloon() {
  var red = createSprite(0,randomNumber(20, 370), 10, 10);
  red.setAnimation("red");
  red.velocityX = 3;
  red.lifetime = 150;
  redBalloon.add(red);
  if (arrowGroup.isTouching(redBalloon)) {
  redBalloon.destroyEach();
  arrowGroup.destroyEach();
  score=score+1;
}
}


function blueBalloon() {
  var blue = createSprite(0,randomNumber(20, 370), 10, 10);
  blue.setAnimation("blue");
  blue.velocityX = 3;
  blue.lifetime = 150;
  blueBalloon.add(blue);
if (arrowGroup.isTouching(blueBalloon)) {
  blueBalloon.destroyEach();
  arrowGroup.destroyEach();
  score=score+1;
}}


function greenBalloon() {
  var green = createSprite(0,randomNumber(20, 370), 10, 10);
  green.setAnimation("green");
  green.velocityX = 3;
  green.lifetime = 150;
  greenBalloon.add(green);
if (arrowGroup.isTouching(greenBalloon)) {
  greenBalloon.destroyEach();
  arrowGroup.destroyEach();
  score=score+1;
}}


function yellowBalloon() {
  var yellow = createSprite(0,randomNumber(20, 370), 10, 10);
  yellow.setAnimation("yellow");
  yellow.velocityX = 3;
  yellow.lifetime = 150;
  yellowBalloon.add(yellow);
if (arrowGroup.isTouching(yellowBalloon)) {
  yellowBalloon.destroyEach();
  arrowGroup.destroyEach();
  score=score+1;
}}


function createArrow() {
  var arrow= createSprite(100, 100, 60, 10);
  arrow.x = 360;
  arrow.velocityX = -4;
  arrow.lifetime = 100;
  arrowGroup.add(arrow);
if (arrowGroup.isTouching(arrow)) {
  arrow.destroyEach();
  arrowGroup.destroyEach();
  score=score+1;
}}
//score
var score = 0;
    function draw() {
    text("Score: "+ score, 329, 14);
    var arrow=createSprite(380,200,20,70);
    arrow.setAnimation("arrow");
    var arrowGroup=createSprite(100,50);
     var arrow=createSprite(380,200,20,70);
  
  background.setAnimation("sunshine_showers_1");
  bow.y = World.mouseY;
  createEdgeSprites();
  bow.collide(rightEdge);
  
  background.velocityX = -2;

  if (background.x <0) {
    background.x = background.width/2;
  }
  
  if (keyDown("space")) {
    var temp_arrow = createArrow();
    temp_arrow.setAnimation("arrow");
    temp_arrow.y = bow.y;
    
  } 
   var select_balloon = randomNumber(1,4);
   
  if (World.frameCount % 80 == 0) {
    if (select_balloon == 1) {
      redBalloon();
    } else if (select_balloon == 2) {
      greenBalloon();
    } else if (select_balloon == 3) {
      blueBalloon();
    } else {
      yellowBalloon();
    } 
  }
//The score doesn't show up and I tried to apply a different color 
// which obviously didn't it. The score only shows when there's something
// wrong with the game 
 text("score", 270, 30);
 score.shapeColor="red";
  drawSprites();
         
}