set property of undefined code org

Solutions on MaxInterview for set property of undefined code org by the best coders in the world

showing results for - "set property of undefined code org"
Alonso
03 Jan 2018
1var background = createSprite(0, 0 ,400, 400);
2background.setAnimation("sunshine_showers_1");
3background.scale = 2;
4background.x = background.width/2;
5
6
7var bow = createSprite(380, 200,20,70);
8bow.setAnimation("bow");
9textSize(20);
10textFont("Georgia");
11var arrowGroup;
12function redBalloon() {
13  var red = createSprite(0,randomNumber(20, 370), 10, 10);
14  red.setAnimation("red");
15  red.velocityX = 3;
16  red.lifetime = 150;
17  redBalloon.add(red);
18  if (arrowGroup.isTouching(redBalloon)) {
19  redBalloon.destroyEach();
20  arrowGroup.destroyEach();
21  score=score+1;
22}
23}
24
25
26function blueBalloon() {
27  var blue = createSprite(0,randomNumber(20, 370), 10, 10);
28  blue.setAnimation("blue");
29  blue.velocityX = 3;
30  blue.lifetime = 150;
31  blueBalloon.add(blue);
32if (arrowGroup.isTouching(blueBalloon)) {
33  blueBalloon.destroyEach();
34  arrowGroup.destroyEach();
35  score=score+1;
36}}
37
38
39function greenBalloon() {
40  var green = createSprite(0,randomNumber(20, 370), 10, 10);
41  green.setAnimation("green");
42  green.velocityX = 3;
43  green.lifetime = 150;
44  greenBalloon.add(green);
45if (arrowGroup.isTouching(greenBalloon)) {
46  greenBalloon.destroyEach();
47  arrowGroup.destroyEach();
48  score=score+1;
49}}
50
51
52function yellowBalloon() {
53  var yellow = createSprite(0,randomNumber(20, 370), 10, 10);
54  yellow.setAnimation("yellow");
55  yellow.velocityX = 3;
56  yellow.lifetime = 150;
57  yellowBalloon.add(yellow);
58if (arrowGroup.isTouching(yellowBalloon)) {
59  yellowBalloon.destroyEach();
60  arrowGroup.destroyEach();
61  score=score+1;
62}}
63
64
65function createArrow() {
66  var arrow= createSprite(100, 100, 60, 10);
67  arrow.x = 360;
68  arrow.velocityX = -4;
69  arrow.lifetime = 100;
70  arrowGroup.add(arrow);
71if (arrowGroup.isTouching(arrow)) {
72  arrow.destroyEach();
73  arrowGroup.destroyEach();
74  score=score+1;
75}}
76//score
77var score = 0;
78    function draw() {
79    text("Score: "+ score, 329, 14);
80    var arrow=createSprite(380,200,20,70);
81    arrow.setAnimation("arrow");
82    var arrowGroup=createSprite(100,50);
83     var arrow=createSprite(380,200,20,70);
84  
85  background.setAnimation("sunshine_showers_1");
86  bow.y = World.mouseY;
87  createEdgeSprites();
88  bow.collide(rightEdge);
89  
90  background.velocityX = -2;
91
92  if (background.x <0) {
93    background.x = background.width/2;
94  }
95  
96  if (keyDown("space")) {
97    var temp_arrow = createArrow();
98    temp_arrow.setAnimation("arrow");
99    temp_arrow.y = bow.y;
100    
101  } 
102   var select_balloon = randomNumber(1,4);
103   
104  if (World.frameCount % 80 == 0) {
105    if (select_balloon == 1) {
106      redBalloon();
107    } else if (select_balloon == 2) {
108      greenBalloon();
109    } else if (select_balloon == 3) {
110      blueBalloon();
111    } else {
112      yellowBalloon();
113    } 
114  }
115//The score doesn't show up and I tried to apply a different color 
116// which obviously didn't it. The score only shows when there's something
117// wrong with the game 
118 text("score", 270, 30);
119 score.shapeColor="red";
120  drawSprites();
121         
122}
123
124
125