-
Notifications
You must be signed in to change notification settings - Fork 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
Space jam sprig game #2313
Open
Praveenkushinpi
wants to merge
19
commits into
hackclub:main
Choose a base branch
from
Praveenkushinpi:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Space jam sprig game #2313
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
recursiveforte
added
submission
Game submission
initial review performed
This Sprig app PR has had initial feedback given, and is in a pending state of review
labels
Sep 18, 2024
This is very similar to other games in the gallery- could you add a game mechanic or two to differentiate it? |
Ok
…On Wed, 18 Sept, 2024, 20:51 Cheru Berhanu, ***@***.***> wrote:
This is very similar to other games in the gallery- could you add a game
mechanic or two to differentiate it?
—
Reply to this email directly, view it on GitHub
<#2313 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BIELRJAPREJJ5DNCKBYZCFTZXGK6JAVCNFSM6AAAAABN3VXXSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJYG43DQMRYGA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
initial review performed
This Sprig app PR has had initial feedback given, and is in a pending state of review
submission
Game submission
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
Author name
praveenkumar:
About your game
**my game is about a astronaut who has to protect his spaceship from meteors **
You have don't have to colide by the meteor and if you collide with the meteor the game is over them you to score as more as possible by dodging the meteor
https://sprig.hackclub.com/share/6YOxOcUA5PRGcuOWTbWA
How do you play game?
You can play game by using a and d ,
A for left and D for right.
Code
const rocket = "r";
const space = "s";
const meteor = "m";
let gameOver = false;
setLegend(
[ rocket, bitmap
................ .......0........ ......010....... .....01710...... ....0177710..... ...017727710.... ..01772227710... ...222222222.... ...222222222.... ...222202222.... ...202020202.... ...222020222.... ...202002202.... ...202020202.... ...222022222.... ...222222222....
] ,[ space, bitmap
0000000000000000 0020000000000020 0000000000000000 0000002000020000 0000000000000000 0000000000000000 0002000000000200 0000000020000000 0200000000000000 0000000000000000 0000000000000000 0000000000000000 0020000002000200 0000000000000000 0000000000000000 0000000000000000
],[ meteor, bitmap
................ ......000000.... ....001110110... ...01111111110.. ...01101111110.. ...01111011110.. ..011011111110.. ..011111111010.. .0111111011110.. .0111111111110.. ..011101111110.. .011111111010... ..01101111110... ..0111111110.... ...00111010..... .....00000......
]);
setSolids([]);
let score = 0;
let level = 0;
const levels = [
map
........... ........... ........... ........... ........... ........... ........... ........... .....r.....
];
setMap(levels[level]);
setSolids([meteor]);
let gameRunning = true;
function spawnMeteor() {
let x = Math.floor(Math.random() * 10);
let y = 0;
addSprite(x, y, "m");
}
function moveMeteor() {
let meteors = getAll("m");
for (let i = 0; i < meteors.length; i++) {
meteors[i].y += 1;
}
}
function despawnMeteor() {
let meteors = getAll("m");
for (let i = 0; i < meteors.length; i++) {
if (meteors[i].y == 8) {
meteors[i].remove();
}
}
}
function checkHit() {
let meteors = getAll("m");
let r = getFirst("r");
for (let i = 0; i < meteors.length; i++) {
if (meteors[i].x == r.x && meteors[i].y == r.y) {
return true;
}
}
return false;
}
onInput("a", () => {
getFirst("r").x -= 1;
});
onInput("d", () => {
getFirst("r").x += 1;
});
setBackground(space);
var gameLoop = setInterval(() => {
if (checkHit()) {
gameOver = true;
clearInterval(gameLoop);
addText(
Game Over! Final Score: ${score}
, { x: 4, y: 4, color: color3
});return;
}
score += 1;
addText(
Score: ${score}
, { x: 8, y: 1, color: color2
});despawnMeteor();
moveMeteor();
spawnMeteor();
}, 300);
Image (If an image is used)
/games/img
directory]Praveenkushinpi@2bcb75c).