Skip to content

Commit

Permalink
fix: Remove wrong img value. re #1579
Browse files Browse the repository at this point in the history
  • Loading branch information
GalaxyGamingBoy authored and Cosmin-Mare committed Jun 18, 2024
1 parent 13c06b7 commit 2b88e71
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 104 deletions.
8 changes: 4 additions & 4 deletions games/Countdown_Golf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5654,17 +5654,17 @@ const addArrows = (x1, y1, x2, y2) => {
? upIn
: downIn
: xStep > 0
? leftIn
: rightIn;
? leftIn
: rightIn;

const outArrow =
xStep === 0
? yStep > 0
? downOut
: upOut
: xStep > 0
? rightOut
: leftOut;
? rightOut
: leftOut;

addSprite(x1, y1, outArrow);
addSprite(x2, y2, inArrow);
Expand Down
200 changes: 100 additions & 100 deletions games/dino-game.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ setLegend(
000.0000000.0000
..........000...`]
)

var runmap = map`
........
dggggggg`
Expand All @@ -124,116 +124,116 @@ var score = 0
var waiting = false


function do_jump(){
if(jump == 1){
return
}else{
if(top_map[0] == raptor){
game_over()
}
if(getFirst(dino).y){
getFirst(dino).y -= 1
jump = 1
jump_timer = setTimeout(end_jump, jump_time);
}
function do_jump() {
if (jump == 1) {
return
} else {
if (top_map[0] == raptor) {
game_over()
}
if (getFirst(dino).y) {
getFirst(dino).y -= 1
jump = 1
jump_timer = setTimeout(end_jump, jump_time);
}
}
}
function end_jump(){
if(bot_map[0] != ground){
game_over()
}
if(getFirst(dino).y == 0){ // ==0 bc otherwise it'll be false
getFirst(dino).y += 1
jump = 0
}

function end_jump() {
if (bot_map[0] != ground) {
game_over()
}
if (getFirst(dino).y == 0) { // ==0 bc otherwise it'll be false
getFirst(dino).y += 1
jump = 0
}
}

onInput("w", () => {
if(playing == 0 && !waiting){
playing = 1
addText(" ", {
x: 0,
y: 6,
color: color`0`
});
top_map = "........"
bot_map = "gggggggg"
runmap = top_map + "\n" + bot_map
setMap(runmap)
addSprite(0, 1, dino)
jump = 0
tick()
}else if(!waiting){
do_jump()
}
})

function tick(){
top_next = "."
switch (last) {
case ground:
var options = [ground, ground, ground, ground, ground, ground, cactus1, cactus2, raptor]
next = options[Math.floor(Math.random() * options.length)]
last = next
if(next == raptor){
top_next = raptor
next = ground
}
break;
default:
next = ground
last = next
break;
}
top_map = top_map.slice(1) + top_next
bot_map = bot_map.slice(1) + next
onInput("w", () => {
if (playing == 0 && !waiting) {
playing = 1
addText(" ", {
x: 0,
y: 6,
color: color`0`
});
top_map = "........"
bot_map = "gggggggg"
runmap = top_map + "\n" + bot_map
setMap(runmap)
if(jump == 0){
if(bot_map[0] != ground){
game_over()
return
}
addSprite(0, 1, dino)
}else{
if(top_map[0] == raptor){
game_over()
return
}
addSprite(0, 0, dino)
addSprite(0, 1, dino)
jump = 0
tick()
} else if (!waiting) {
do_jump()
}
})

function tick() {
top_next = "."
switch (last) {
case ground:
var options = [ground, ground, ground, ground, ground, ground, cactus1, cactus2, raptor]
next = options[Math.floor(Math.random() * options.length)]
last = next
if (next == raptor) {
top_next = raptor
next = ground
}
break;
default:
next = ground
last = next
break;
}
top_map = top_map.slice(1) + top_next
bot_map = bot_map.slice(1) + next
runmap = top_map + "\n" + bot_map
setMap(runmap)
if (jump == 0) {
if (bot_map[0] != ground) {
game_over()
return
}
if(time > min_time){
time -= 10
jump_time -= 10
addSprite(0, 1, dino)
} else {
if (top_map[0] == raptor) {
game_over()
return
}
score += const_time - time
addText(String(1000000+score).slice(1), {
x: 14,
y: 6,
color: color`0`
});
tick_timer = setTimeout(tick, time)
}

function game_over(){
clearTimeout(tick_timer)
clearTimeout(jump_timer)
playing = 0
score = 0
time = const_time
jump_time = const_jump_time
addText("Game Over", {
x: 0,
y: 6,
color: color`0`
});
waiting = true
setTimeout(()=>{waiting = false}, 2000)
addSprite(0, 0, dino)
}
if (time > min_time) {
time -= 10
jump_time -= 10
}
score += const_time - time
addText(String(1000000 + score).slice(1), {
x: 14,
y: 6,
color: color`0`
});
tick_timer = setTimeout(tick, time)
}

addText("Press W to start", {
function game_over() {
clearTimeout(tick_timer)
clearTimeout(jump_timer)
playing = 0
score = 0
time = const_time
jump_time = const_jump_time
addText("Game Over", {
x: 0,
y: 6,
color: color`0`
});
waiting = true
setTimeout(() => { waiting = false }, 2000)
}

addText("Press W to start", {
x: 0,
y: 6,
color: color`0`
});

0 comments on commit 2b88e71

Please sign in to comment.