Respuesta :
Answer:
radius = (get_width() / NUM_CIRCLES / 2)
x = radius
for i in range(NUM_CIRCLES):
circ = Circle(radius)
if i % 2 == 0:
circ.set_color(Color.red)
else:
circ.set_color(Color.green)
circ.set_position(x, get_height() / 2)
add(circ)
current_spot = x
x = current_spot + (radius * 2)
Explanation:
Answer:
var NUM_CIRCLES = 15;
var radius=getWidth()/(NUM_CIRCLES*2);
var x=radius;
function start(){
for (var i=0; i<NUM_CIRCLES; i++){
if (i%2==0){
drawRedWorm();
}else{
drawGreenWorm();
}
var xPosition=x;
x=xPosition+(radius*2)
}
}
function drawRedWorm(){
var circle=new Circle(getWidth()/(NUM_CIRCLES*2));
circle.setPosition(x , getHeight()/2 );
circle.setColor(Color.red);
add (circle);
}
function drawGreenWorm(){
var circle=new Circle(getWidth()/(NUM_CIRCLES*2));
circle.setPosition(x , getHeight()/2 );
circle.setColor(Color.green);
add (circle);
}
Explanation:
codeHs