createEdgeSprites();
var level = 0;
var player = createSprite(200, 200);
var next = createSprite(375, 75);
next.setAnimation("goldui16_result_1");
player.setAnimation("animation_1");
var ground = createGroup();
ground.add(createSprite(47,110,150,50));
ground.setRotationEach(30);
ground.add(createSprite(200,350,300,200));
ground.add(createSprite(100,150,150,50));
ground.add(createSprite(400,250,100,300));
drawSprites();
function draw() {
moving();
LEVELUP();
}
function moving() {
background("white");
if (keyDown("left")) {
player.x = player.x - 2;
} else if (keyDown("right")) {
player.x = player.x + 2;
}
if (keyDown("up")||keyDown("space")){
player.y = player.y + 3 ;
if (player.isTouching(ground)) {
player.y = player.y - 10;
player.velocityY = -20 ;
} else {
player.y = player.y - 3 ;
}
}
drawSprites();
player.collide(ground);
if (player.isTouching(ground)){
while (player.isTouching(ground)) {
player.velocityY = 0 ;
player.y = player. y - 0.1 ;
}} else {
// gravity
player.velocityY = player.velocityY + 1.5;
}
}
function LEVELUP() {
if (player.isTouching(next)) {
level = level+1;
}
if (level===1) {
ground.destroyEach();
}
}
That is da code (all of it so far)