ZeldariaLvl 41
So, I am working on practicing my platformer-making skills and I coded a thing that when the player touches it, it turns the level up by 1; but for some reason it adds like 3 when I touch it! Please help how do I solve this?!
So, I am working on practicing my platformer-making skills and I coded a thing that when the player touches it, it turns the level up by 1; but for some reason it adds like 3 when I touch it! Please help how do I solve this?!
Zeldaria uh slow it down
Or have set ones with requirements like have 2000 gold and level 2
hmmm yeah that's a good idea! I'll try it! Thx!
the error might be that it is checking if the player is touching multiple times, the check might be in a function that is used multiple times every draw, but i have no way of knowing unless i can see the code
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)
ok so whats happening is when the player touches next
the ground moves but next
does not move so the next frame the player is still touching next
.
ooooooh ok! IT WORKED! Thx everybody!
ackvonhuelio You lied to me
??????????
Zeldaria I am talking to ackvonhuelio
ok
Fluffypoopo
what did I do
for real what did I do
I helped someone, is that a crime now?
I don't recall saying that I wouldn't help anyone..
ackvonhuelio the code website you said was good is
PAIN
Fluffypoopo
KA?
wdym
heres a list of reasons why it's better than CDO:
and any more things that make it far superior to CDO
sucks in breath Is this still about game lab or...?
Zeldaria
most likely...
no