Share your repls and programming experiences

← Back to all posts
Space Runner (Please look, I barely have any upvotes)
[deleted]

I made a runner for the game jam. The controls are in the game, just scroll down.

I made the game with html, css, and javascript.
Please comment to tell me if you like the game/have any suggestions.
Click to open (works best in a new tab).
My code is here.

If everything blurs when you start (happens occasionally on edge), that means the background is still loading (and the loading screen still went away for some reason). Wait a bit, and the background should load. Then everything will look normal again.
Also, it's 4K (if 4000 by 2000 is 4K).

Please give me suggestions on what to add next (I have no idea myself).

NOTES TO JUDGES:

The history might look a bit weird, I did half the work in my repl.it project called "stuff" and then moved it to where it is now, in the project "Space Runner". I copied it over on April 16th I think, I don't know if the history will go back past then because I download the zip from my other project and uploaded it to the new one.

Commentshotnewtop
[deleted]

It isn't done, I'll be adding more stuff.

GabrielaPalla (0)

This is so awesome!! Really liked the effort you put into the design, it looks great.

[deleted]

@GabrielaPalla
Thanks! What should I add next (You beat the game at 50,000)?
Also, click one of the links and watch my redirect animation.

bearbearmo (186)

I had a look at the code, I'm interested why you used functions for the majority of what could have been done with classes, I may be very wrong but from what I understand classes would be better. Also, you use

var

where let or const would be better
The game itself is very good, although i would say the movement is a little sluggish, I don't know if that's intentional but it stopped me from playing after I died.

[deleted]

@bearbearmo I'll turn up the movement speed a bit.
Also, classes are just "special" functions.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

Also when you die, press 1 to continue.

bearbearmo (186)

@GameMaster1928


classes are nice functions, personally I prefer them, I was wondering if there was a specific reason for not using them but if not that's fine

[deleted]

I just added a boss at 15,000!

I also stopped the arrows and space from scrolling.

You can also pause now!

Equation (195)

Great game ! Graphics are nice, and I have some questions to ask you :
How did you make the background move ?
How do you make to put some image for your charachter and to make them move ?
How did you make to have a little ship as tab picture (default is a document paper, do you see what I mean ?)
How did you add some sound effects ?
This is a very good game, but I play on a french keyboard (azerty), so it would be nice to add an option to control the ship with arrows.

[deleted]

@Equation, I just added a link to my code, so you can look at what I did. I also just added arrow controls.

I made the background move on lines 338-345 (look at background.jpg and stars.png to understand how to prepare an image). I looked for a seamless image and tiled it twice horizontally, and subtracted from the x every frame. When the x was less than the negative canvas width (-2000), I set the background's x to 0.

I drew the images using cxt.drawImage(image, x, y);
I made it move by just changing a variable I'm using for the x and y position.
I created the images with 2 lines of code:
var name = new Image();
name.src = "file location";

I changed the tab icon with this line:

<link href="file location" rel="icon">

I added the sound effects like this:
var name = new Audio("file location");
To play the audio:
name.play();
To make the audio loop:
name.loop = true;

[deleted]

@Equation, I've made a lot of improvements in the last 10 days, try my game again!

ThomasLairy (1)

it's abit slow you should create ergonomic keyboard key