-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Asteroid dodge? #1108
Add Asteroid dodge? #1108
Conversation
*Total -- 27,761.63kb -> 21,994.64kb (20.77%) /games/img/dvd_logo_simulator.png -- 9.44kb -> 0.49kb (94.81%) /games/img/coding_demo_4_screen_scroll.png -- 38.91kb -> 2.12kb (94.55%) /games/img/two-birds_one-stone.png -- 25.98kb -> 1.73kb (93.36%) /games/img/Disco.png -- 24.25kb -> 1.73kb (92.87%) /games/img/thumbnail.png -- 19.76kb -> 1.46kb (92.63%) /games/img/Burger_Maker_V1.png -- 25.90kb -> 1.92kb (92.6%) /games/img/portal_game.png -- 32.81kb -> 2.47kb (92.46%) /games/img/wet-sand.png -- 23.33kb -> 1.95kb (91.65%) /games/img/hex_hubbub.png -- 13.81kb -> 1.16kb (91.64%) /games/img/2048 Alphabet Edition.png -- 7.99kb -> 0.74kb (90.78%) /games/img/coding_demo_2_multiple_maps.png -- 25.62kb -> 2.38kb (90.7%) /games/img/BoxCubeGuy.png -- 9.82kb -> 0.94kb (90.45%) /games/img/Bash_Game.png -- 43.25kb -> 4.20kb (90.28%) /games/img/calculator.png -- 25.84kb -> 2.53kb (90.22%) /games/img/Flamin_Finger.png -- 22.71kb -> 2.25kb (90.1%) /games/img/the_hungry_mouse.png -- 61.65kb -> 6.65kb (89.22%) /games/img/SOS_Game.png -- 24.23kb -> 2.66kb (89.01%) /games/img/Alien_Attack.png -- 23.53kb -> 2.61kb (88.91%) /games/img/Astrovoid.png -- 23.66kb -> 2.74kb (88.4%) /games/img/Ninja_In_A_Bear_Trap_Factory.png -- 11.88kb -> 1.38kb (88.35%) /games/img/Temple.png -- 62.06kb -> 7.86kb (87.33%) /games/img/Space_Invasion.png -- 8.53kb -> 1.12kb (86.84%) /games/img/Mastermind.png -- 27.80kb -> 3.82kb (86.27%) /games/img/Stop.png -- 44.58kb -> 6.13kb (86.26%) /games/img/speedy_snake.png -- 18.08kb -> 2.56kb (85.84%) /games/img/Conquerers.png -- 30.49kb -> 4.70kb (84.57%) /games/img/The_Pet.png -- 22.26kb -> 3.56kb (83.99%) /games/img/DogsvsCats.png -- 13.07kb -> 2.19kb (83.22%) /games/img/pong.png -- 11.01kb -> 2.20kb (80%) /games/img/Simon-WASD_Edition.png -- 47.86kb -> 9.64kb (79.85%) /games/img/fungi-frog-maze.png -- 58.96kb -> 13.50kb (77.11%) /games/img/2048.png -- 57.56kb -> 13.33kb (76.84%) /games/img/Rolling Obstacles.png -- 6.73kb -> 1.70kb (74.81%) /games/img/goaled.png -- 5.67kb -> 1.43kb (74.79%) /games/img/whack_a_mole.png -- 10.57kb -> 2.72kb (74.27%) /games/img/CATCH-ME.png -- 3.63kb -> 0.97kb (73.18%) /games/img/Falling_Water.png -- 31.27kb -> 8.39kb (73.16%) /games/img/Invisible_Maze.png -- 3.93kb -> 1.06kb (73.12%) /games/img/Snake.png -- 6.96kb -> 1.88kb (72.95%) /games/img/snakey snake.png -- 46.32kb -> 12.78kb (72.4%) /games/img/tetris.png -- 6.66kb -> 1.84kb (72.37%) /games/img/RandomDungeon-final.png -- 49.04kb -> 13.66kb (72.14%) /games/img/UFO_Attack.png -- 3.32kb -> 0.96kb (71.04%) /games/img/Rock_Paper_Scissors.png -- 41.27kb -> 12.02kb (70.87%) /games/img/bannai-snake.png -- 40.10kb -> 11.76kb (70.67%) /games/img/Fish_in_the_Sea.png -- 6.28kb -> 1.89kb (69.93%) /games/img/Screen Shot 2022-08-09 at 11.40.58 PM.png -- 35.80kb -> 10.84kb (69.72%) /games/img/Bottom_of_the_Barrel.png -- 2.87kb -> 0.88kb (69.23%) /games/img/raycasting.png -- 11.11kb -> 3.44kb (69.09%) /games/img/Tic-Tac-No.png -- 5.93kb -> 1.84kb (68.98%) /games/img/BigButton.png -- 8.75kb -> 2.74kb (68.65%) /games/img/Asteroid_Apocalypse.png -- 5.96kb -> 1.88kb (68.5%) /games/img/generic_dungeon_crawler.png -- 10.70kb -> 3.42kb (68.07%) /games/img/penguin_slide.png -- 10.63kb -> 3.52kb (66.92%) /games/img/Jumper.png -- 3.86kb -> 1.32kb (65.89%) /games/img/Dragon_Fest.png -- 5.94kb -> 2.03kb (65.85%) /games/img/Flying_Game.png -- 7.14kb -> 2.45kb (65.68%) /games/img/friendship.png -- 27.53kb -> 9.58kb (65.19%) /games/img/thunderball.png -- 5.54kb -> 2.04kb (63.07%) /games/img/breakfast_maze!.png -- 22.27kb -> 8.28kb (62.82%) /games/img/Falling_Blocks.png -- 9.12kb -> 3.42kb (62.51%) /games/img/Gravity is a Thing.png -- 2.21kb -> 0.85kb (61.58%) /games/img/Mining_Simulator.png -- 3.09kb -> 1.19kb (61.47%) /games/img/Jet_Box.png -- 2.25kb -> 0.87kb (61.25%) /games/img/DontGetBurnt.png -- 5.65kb -> 2.20kb (61.11%) /games/img/3D_wire_frame_rendererV1.png -- 4.44kb -> 1.74kb (60.89%) /games/img/reversi.png -- 9.85kb -> 3.88kb (60.62%) /games/img/flappy_bird_but_no_gravity_and_worse.png -- 10.23kb -> 4.05kb (60.36%) /games/img/echolocation.png -- 73.11kb -> 29.19kb (60.08%) /games/img/TheMazeOfSprig.png -- 3.55kb -> 1.42kb (60.08%) /games/img/sprig_dodge.png -- 2.55kb -> 1.02kb (59.8%) /games/img/3072_A_2048_Spin-Off.png -- 4.63kb -> 1.89kb (59.11%) /games/img/bullet_dodge.png -- 3.12kb -> 1.29kb (58.48%) /games/img/Limits.png -- 11.82kb -> 4.94kb (58.19%) /games/img/among_us_maze.png -- 6.55kb -> 2.74kb (58.19%) /games/img/Call911.png -- 3.99kb -> 1.68kb (57.9%) /games/img/infinite_maze.png -- 0.99kb -> 0.42kb (57.62%) /games/img/SprigClick.png -- 2.16kb -> 0.92kb (57.51%) /games/img/Fire_Hound.png -- 5.88kb -> 2.51kb (57.38%) /games/img/Mirror_Snake.png -- 1.63kb -> 0.70kb (57.24%) /games/img/Sort.png -- 2.70kb -> 1.16kb (57.2%) /games/img/1930.png -- 21.38kb -> 9.17kb (57.11%) /games/img/hackcraft.png -- 7.96kb -> 3.43kb (56.9%) /games/img/crimbletips.png -- 3.42kb -> 1.48kb (56.63%) /games/img/crimbletips1.png -- 3.42kb -> 1.48kb (56.63%) /games/img/Piano.png -- 2.55kb -> 1.11kb (56.36%) /games/img/bbbbbb.png -- 1.88kb -> 0.83kb (55.91%) /games/img/Mandelbrot.png -- 6.39kb -> 2.82kb (55.85%) /games/img/rickroll.png -- 3.42kb -> 1.51kb (55.84%) /games/img/drab_bullets.png -- 2.57kb -> 1.14kb (55.64%) /games/img/Defend_the_Keep.png -- 1.56kb -> 0.70kb (55.33%) /games/img/under_fire.png -- 14.81kb -> 6.63kb (55.23%) /games/img/Linebeck-Land.png -- 2.42kb -> 1.08kb (55.13%) /games/img/inconsequential_leveldungeon.png -- 3.35kb -> 1.50kb (55.09%) /games/img/sprig_machine.png -- 109.64kb -> 49.52kb (54.84%) /games/img/sprig_mario.png -- 6.38kb -> 2.88kb (54.8%) /games/img/Thumbnail Apple.png -- 3.34kb -> 1.51kb (54.67%) /games/img/sudoku.png -- 5.43kb -> 2.54kb (53.19%) /games/img/delightful_mazes.png -- 6.91kb -> 3.28kb (52.54%) /games/img/sprigle.png -- 1.45kb -> 0.69kb (52.32%) /games/img/Skyrace.png -- 19.39kb -> 9.25kb (52.29%) /games/img/charge.png -- 2.47kb -> 1.19kb (51.88%) /games/img/randomworld.png -- 3.29kb -> 1.59kb (51.77%) /games/img/pipes_puzzle.png -- 50.76kb -> 25.62kb (49.53%) /games/img/Find_The_Suspect.png -- 6.37kb -> 3.22kb (49.42%) /games/img/simon.png -- 40.59kb -> 20.57kb (49.32%) /games/img/niabtf2.png -- 4.85kb -> 2.47kb (49.13%) /games/img/A_Really_One_Sided_Duel.png -- 5.18kb -> 2.64kb (48.98%) /public/stories-big/develop.jpeg -- 3,777.25kb -> 1,942.25kb (48.58%) /games/img/attack_on_slimes.png -- 5.77kb -> 3.00kb (48%) /games/img/galacticats.png -- 16.37kb -> 8.60kb (47.46%) /games/img/cookie_clicker.png -- 5.50kb -> 2.90kb (47.19%) /games/img/Recycling_Turtle.png -- 21.88kb -> 11.61kb (46.95%) /games/img/zombie_defense.png -- 12.77kb -> 6.79kb (46.83%) /games/img/the RUN.png -- 0.95kb -> 0.50kb (46.76%) /games/img/desi-pong.png -- 6.64kb -> 3.54kb (46.68%) /games/img/QuadraPedal.png -- 4.88kb -> 2.61kb (46.56%) /games/img/Cross_The_Road.png -- 3.87kb -> 2.08kb (46.39%) /games/img/Amoeba.png -- 5.58kb -> 3.01kb (46.15%) /games/img/really_really_bad_music_maker.png -- 17.36kb -> 9.38kb (45.99%) /games/img/Amazing_Mazes.png -- 117.61kb -> 63.93kb (45.64%) /games/img/Snake_4_2.png -- 4.67kb -> 2.54kb (45.59%) /games/img/floppyMatch.png -- 3.44kb -> 1.89kb (45.08%) /games/img/son_of_a_lich.png -- 11.41kb -> 6.39kb (43.97%) /games/img/Dragon-Rush.png -- 536.93kb -> 303.59kb (43.46%) /games/img/fight_big_parma.png -- 5.07kb -> 2.87kb (43.33%) /games/img/Art.png -- 7.34kb -> 4.17kb (43.16%) /games/img/font-explorer.png -- 14.29kb -> 8.32kb (41.81%) /docs/assets/wheres_waldo_uf2.png -- 42.06kb -> 26.64kb (36.67%) /games/img/Physics_Sandbox.png -- 25.61kb -> 16.66kb (34.96%) /games/img/alien.png -- 4.18kb -> 2.72kb (34.89%) /games/img/Duck_Hunt.png -- 1.31kb -> 0.86kb (34.68%) /docs/assets/drag_n_drop.png -- 217.00kb -> 142.71kb (34.24%) /public/screenshots/upload.png -- 497.28kb -> 332.03kb (33.23%) /games/img/Battle_City.png -- 151.56kb -> 101.49kb (33.03%) /games/img/Golem-Rush.png -- 0.85kb -> 0.58kb (32.11%) /games/img/L0st.png -- 29.05kb -> 19.79kb (31.89%) /games/img/Robot_Party_Basic_Buildv1.jpg -- 9.55kb -> 6.52kb (31.73%) /games/img/snek.png -- 1.07kb -> 0.74kb (31.36%) /games/img/killpigs.png -- 10.49kb -> 7.21kb (31.24%) /public/screenshots/contribute.png -- 578.85kb -> 398.26kb (31.2%) /games/img/Trash IT.png -- 141.24kb -> 99.49kb (29.56%) /games/img/TheTombOfAThousandTerrors.png -- 5.97kb -> 4.21kb (29.47%) /games/img/Avoid_The_Tree.png -- 32.67kb -> 23.21kb (28.95%) /games/img/dual_state_machine.png -- 8.46kb -> 6.05kb (28.5%) /games/img/It_Is_Coming_Out!.png -- 8.84kb -> 6.34kb (28.28%) /games/img/Conway's Game of Life.png -- 8.12kb -> 5.98kb (26.28%) /games/img/creepy_crush.png -- 43.88kb -> 32.97kb (24.87%) /games/img/gravity_fun.png -- 126.86kb -> 95.93kb (24.38%) /docs/assets/sprig.png -- 3,349.45kb -> 2,541.47kb (24.12%) /games/img/ROOM.png -- 16.90kb -> 12.84kb (23.99%) /games/img/offline_t-rex_game.png -- 26.89kb -> 20.76kb (22.81%) /games/img/hectic_hockey.png -- 13.11kb -> 10.20kb (22.23%) /games/img/dihyrdogen_monoxide_free_fall.png -- 39.79kb -> 32.07kb (19.41%) /public/screenshots/export.png -- 200.02kb -> 161.63kb (19.19%) /public/screenshots/fork.png -- 249.56kb -> 207.86kb (16.71%) /public/screenshots/thumbnail.png -- 242.04kb -> 201.72kb (16.66%) /games/img/connectTheDots.png -- 8.76kb -> 7.43kb (15.19%) /games/img/Friendly_Figures.png -- 26.83kb -> 23.01kb (14.23%) /games/img/Paint_IT.png -- 47.28kb -> 41.11kb (13.05%) /games/img/black_jack.png -- 3.54kb -> 3.18kb (10.31%) /games/img/Virtual_Machine.png -- 36.34kb -> 32.73kb (9.95%) /games/img/love_lock.png -- 51.16kb -> 46.97kb (8.2%) /games/img/cubefield.png -- 21.61kb -> 19.95kb (7.66%) /public/stories-big/sprig-back.jpeg -- 1,303.58kb -> 1,224.17kb (6.09%) /docs/assets/default_screen.jpg -- 2,664.74kb -> 2,533.28kb (4.93%) /public/stories-big/learn.jpeg -- 3,402.33kb -> 3,241.77kb (4.72%) /public/stories-big/play.jpeg -- 2,461.46kb -> 2,356.38kb (4.27%) /public/stories-big/orpheus.jpeg -- 2,294.27kb -> 2,216.21kb (3.4%) /games/img/fractal_generator.png -- 37.03kb -> 35.84kb (3.21%) /public/stories-big/sprig-front.jpeg -- 2,370.90kb -> 2,301.07kb (2.94%) /public/stories-tiny/play.jpeg -- 71.59kb -> 69.69kb (2.66%) /public/stories-tiny/learn.jpeg -- 80.36kb -> 79.64kb (0.89%) /public/stories-tiny/orpheus.jpeg -- 47.45kb -> 47.06kb (0.82%) /public/stories-tiny/sprig-front.jpeg -- 53.17kb -> 52.82kb (0.66%) /public/stories-tiny/sprig-back.jpeg -- 38.98kb -> 38.74kb (0.62%) /public/stories-tiny/develop.jpeg -- 46.00kb -> 45.83kb (0.37%) /public/pcb.svg -- 198.90kb -> 198.87kb (0.01%) Signed-off-by: ImgBotApp <[email protected]>
[ImgBot] Optimize images
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@V205Arduino is attempting to deploy a commit to the Hack Club Team on Vercel. A member of the Team first needs to authorize it. |
https://sprig.hackclub.com/share/L2pIwSIf3G49OfL98sMc Game is also here… |
I think the file is called asteroid_dodge.js |
No it is Asteroid_Dodge.js |
I got a pull request by a robot for down sizing images…. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I apply for a free Sprig?
Just making a PR, like how you're doing:)
Hey! I have a few questions:
All these files are part of your game?
what editor did you use?
Revert "[ImgBot] Optimize images"
All these files are part of your game? Asteroid_Dodge.js Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right! nice game! Congrats:)
If you're a teen, you can get your sprig here! https://sprig-order.hackclub.dev/
Hack Clubbers would love to see this! Just post a link and 1-2 sentences talking about your game to our #ship channel:)
Deployment failed with the following error:
|
Hey! I'm getting some errors so I'll close this PR and add your game manually:) If you want improve more your game, make a new PR! |
oh right! nice game! Congrats:) |
Is the file name still the same? |
yep! |
Thank you! |
Hello @LucasHT22 PS: Please don’t post the info here it contains my PII. |
Thanks! |
I'll check! What's your @ on Slack? So I dm to you |
Need to make a slack account first. |
Would be better Slack but alright, what's your email? |
[email protected] |
Hey @V205Arduino ! Our mail coordinator said that your Sprig already has been shipped! All your school information is everything good |
Ok @LucasHT22 Thank you! |
Your checklist for this pull request
Author name
Author:
V205Arduino
V205
About your game
What is your game about?
Asteroid Dodge!
In this game you use the w and s keys to control a spaceship.
Avoid asteroids and collect coins and powerups(WIP).
There is a 1 in 4 chance of a coin being generated in second.
The default difficulty is one asteroid per second.
You can change the difficulty level by changing the difficulty variable.
If you set changeDifficulty to true the difficulty will increase by one ever hundred seconds.
I based this game off the dodge tutorial.
I will continue improving this game for a while.
What should I improve?
How do I apply for a free Sprig?
Does this project qualify?
Thanks!
How do you play your game?
W key to push spaceship up.
S key to push it down.
Code
/*
@title: Asteroid_Dodge!
@author: V205
*/
// Thanks to Hackclub and tutorials!
// Setup stuff!
//Sprites!
const player = "p"; // Define Player
const coin = "c";// Define Coin
const obstacle = "o";// Define obstacle(asteroids)
const background = "b";// Define background. Only used to create space.
const wall = "w";// Used to create space for text.
//Tunes!
const gamePlayTune = tune
75, 37.5: D5^37.5, 37.5: D5^37.5, 37.5: C5^37.5, 37.5: C5^37.5, 37.5: C5^37.5, 37.5: G4^37.5, 37.5: G4^37.5, 37.5: G4^37.5, 37.5, 37.5: A5^37.5, 75, 37.5: B4^37.5, 150, 37.5: A5^37.5, 37.5: A5^37.5, 37.5, 37.5: C4^37.5, 37.5, 37.5: A5^37.5, 37.5: A5^37.5, 37.5, 37.5: A5^37.5, 37.5: A5^37.5, 112.5
// Game tune.const gameEndTune = tune
133.92857142857142, 133.92857142857142: B5^133.92857142857142, 133.92857142857142: A5^133.92857142857142, 133.92857142857142: G5^133.92857142857142, 133.92857142857142: F5^133.92857142857142, 133.92857142857142: E5^133.92857142857142, 133.92857142857142: D5^133.92857142857142, 133.92857142857142: C5^133.92857142857142, 133.92857142857142: B4^133.92857142857142, 133.92857142857142: A4^133.92857142857142, 133.92857142857142: G4^133.92857142857142, 133.92857142857142: F4^133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142: E4^133.92857142857142, 133.92857142857142, 133.92857142857142: D4^133.92857142857142, 133.92857142857142: D4^133.92857142857142, 133.92857142857142, 133.92857142857142: C4^133.92857142857142, 133.92857142857142: C4^133.92857142857142, 535.7142857142857
// Wa wa wa wa. You lost!//Variables!
var gameTime = 0;// How long have you been playing?
var coinsCollected = 0; // How many coins?
var difficulty = 1; // Difficulty increases every hundred. Might become impossible at 300 or less.
var changeDifficulty = false; //Change to true if you want the difficulty to increase by one every hundred seconds.
//Set bitmaps.
setLegend(
[obstacle, bitmap
0000000000000000 0000000000000000 0000000LLL000000 00000LLL11LL0000 0000LLL11LLLL000 000LLL11LLL0L000 000LL11LLL11LL00 000LL1LLL111L100 00LLLLLLL100L100 000LLLLLL111LL00 000LLL11111LL000 000LLL1111LLL000 0000LLLLLLLL0000 00000LLLL1100000 0000000LL1000000 0000000000000000
], // Obstacles(asteroids)[player, bitmap
................ ................ ..999........... ..9999.......... ..99999......... .99999999....... .999229999...... 39922229999..... 399222299999.... 3992222999999... 999922999999.... 99999999999..... .9999999........ .9999........... .99............. ................
],// Spaceship[background, bitmap
0000000000000000 0000000000000000 0000000000000000 0002000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000200 0000000000000000
],// Background[coin, bitmap
0000000000000000 0000066666000000 0000666666600000 0006699996600000 0066996666660000 0066966666660000 0666966666666000 0669966666666600 0669966666666660 0066996666666660 0066699666666600 0006669999666000 0006666666660000 0000666666600000 0000066660000000 0000000000000000
],// coin. Very ugly.[wall, bitmap
0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000
],// Black square.)
setMap(map
wwwwwwww ........ ........ ........ ........ p....... ........ ........ ........ ........
);// set map.setSolids([wall, player]);// Don't allow other things to go inside these things.
setBackground(background);// Set background.
var gameRunning = true; //This will go to false if you crash into a asteroid.
// End Setup stuff
// Controlls.
onInput("w", () => {
if (gameRunning) {
getFirst(player).y -= 1;
}
});
onInput("s", () => {
if (gameRunning) {
getFirst(player).y += 1;
}
});
// Obstacle management.w
function increaseDifficulty() {
if(gameTime >=101 && changeDifficulty == true){
}
}
function spawnObstacle() {
for (let i = 0; i < difficulty; i++) {
let x = 7;
let y = getRandomNumber(1,9);//old way: Math.floor(Math.random() * 8.5);
}
}
function moveObstacles() {
let obstacles = getAll(obstacle);
for (let i = 0; i < obstacles.length; i++) {
obstacles[i].x -= 1;
}
}
function despawnObstacles() {
let obstacles = getAll(obstacle);
for (let i = 0; i < obstacles.length; i++) {
if (obstacles[i].x == 0) {
obstacles[i].remove();
}
}
}
function checkHit() {
let obstacles = getAll(obstacle);
let p = getFirst(player);
for (let i = 0; i < obstacles.length; i++) {
if (obstacles[i].x == p.x && obstacles[i].y == p.y) {
return true;
}
}
return false;
}
// End Obstacle management.
// Coin management.
function spawnCoins() {
if ( getRandomNumber(1,3)== 1) {
let x = 7;
let y = getRandomNumber(1,9);//old way: Math.floor(Math.random() * 8.5);
}
}
function moveCoins() {
let coins = getAll(coin);
for (let i = 0; i < coins.length; i++) {
coins[i].x -= 1;
}
}
function despawnCoins() {
let coins = getAll(coin);
for (let i = 0; i < coins.length; i++) {
if (coins[i].x == 0) {
coins[i].remove();
}
}
}
function checkCoinHit() {
let coins = getAll(coin);
let p = getFirst(player);
for (let i = 0; i < coins.length; i++) {
if (coins[i].x == p.x && coins[i].y == p.y) {
return true;
}
}
return false;
}
// Function to make random numbers easier.
const getRandomNumber = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
var gameLoop = setInterval(() => {
increaseDifficulty();
despawnObstacles();
moveObstacles();
spawnObstacle();
despawnCoins();
moveCoins();
spawnCoins();
playTune(gamePlayTune);
gameTime += 1;
addText( String(gameTime) , {
x: 0,
y: 0,
color: color
3
});
if(checkCoinHit()){
}
if (checkHit()) {
clearInterval(gameLoop);
gameRunning = false;
clearText();
playTune(gameEndTune);
addText("Game Over!", {
x: 5,
y: 6,
color: color
3
});
addText("Time: "+ String(gameTime), {
x: 5,
y: 7,
color: color
3
});
}
}, 1000)
Check off the items that are true.
/games
directory.-
s, or_
s.Image (If an image is used)
No image yet.
/games/img
directory.