Share your repls and programming experiences

← Back to all posts
Canvas Game
h
matthewproskils (264)

This is my first canvas game, and I had just learned gravity. Please support this by upvoting and creating css for this to look better.

Thanks to @codingcactus for styling & @VulcanWM
ANYONE WHO CREATES CsS STYLING FOR THIS WILL GET A SHOUTOUT

Exactly 200 cycles! :o

I am on trending repls!!!

High Score to @BotProgrammer for 210 high score :D
High score to @inbiegebaden for 306 high score :o
and...
ISAAC!! @isaacproskils for a whopping 967 high score

Commentshotnewtop
gatorade322 (57)

I could remake this game in python turtle if you want to see that

matthewproskils (264)

@gatorade322 Sure! it'll be hard, but i trust that u can do it...

gatorade322 (57)

@matthewproskils I did, but something was wrong with the keypresses, so I just did AI.

BotProgrammer (5)


I could do it forever! I just had to get off the computer :(

ZDev1 (226)

I think you copied it cuz you wrote it in a script element, not in the script.js
If it is wrong... no problem! ;)

matthewproskils (264)

@matthewproskils ooh. you think i copied it from something else...
i did not. I created it myself. This took a few hours (6-7)

ZDev1 (226)

@matthewproskils
This took a few hours (6-7)
Oh, sorry for all this.
I thought that because you made the js code in a script element
But it's ok...
Good job!

matthewproskils (264)

@ZDev1 ooh... I am just very bad at writing external javascript

isaacproskils (6)

@ZDev1 (he acctually spent 9-10 hours)
lol

MrTrex (13)

WOW! Nice game, but i wish you could move with A, and D

matthewproskils (264)

@MrTrex Really? I thought people liked arrow keys better, i'll add it anyways.

mwilki7 (989)

nice
i love working with canvas

matthewproskils (264)

@mwilki7 Thanks! I have experimented with canvas before, but never a game. I think this took me around 7-8 hours....

Latorious (1)

This is really good and well thought out! Maybe the blocks could become faster over time? That would make the highscore a bit more rewarding. Just a suggestion tho, other than that, great game! It was really fun!

EDKTHEPRO (16)

This is cool! :D I sort of have a game like this... PING-PONG!

matthewproskils (264)

@mathiasaboye WOW... I feel so horrible at my own game...

applesX (19)

Is this python code?

matthewproskils (264)

@applesX no, no this is html canvas

Cookiezz (63)

Cool! Maybe you could make the play again button a little bigger?

codeitfast (16)

Cool! I think you might want to add a large grey rectangle that is drawn first to make there be no lines in the background.

codeitfast (16)

@matthewproskils Good Luck! PS: I think there is a canvas clear screen function but I don't remember it.

matthewproskils (264)

@codeitfast Yeah, ctx.clearRect(__)
(ctx is what the canvas is called)

JacksonPhilips (45)

i'll try to style it & make the controls better =)

HerculukeZeEpic (180)

Cool! Can you make a leaderboard though?

ZDev1 (226)

Perfect!

but i can't play it now, I am on pho ne

generationXcode (136)

How do u know when the objects touch each other?

matthewproskils (264)

@generationXcode I check if the object is in the same x axis as the catcher, and if the object's y axis is fifty, they are touching. (if xaxisofobject = xaxisofcatcher{within some range so you don't have to be exactly on top} [they are on top of each other] AND y axis is 50 {basically the object is right over the catcher} then they are touching.

ZainJ (10)

@matthewproskils this is a cool game and is pretty addictive for me :)

matthewproskils (264)

@ZainJ lol, i know right, i played it for like 30 minutes

codingduck (7)

impossible. the keyboard only presses the key once, so it takes aroud a second to get up to speed, and that's a lot in this gme.

matthewproskils (264)

@codingduck so are you saying that i should make the catcher faster

codingduck (7)

@matthewproskils no, im sayng you need to make it so that the character moves if the key is being held and keeps moving until it is not, not when it is pressed. great idea and effort though.

matthewproskils (264)

@codingduck Oh, yes, the character does move if key held (just takes time to see result)

matthewproskils (264)

@CodingCactus wow... i am amazed beyond belief... that was fast and good

matthewproskils (264)

@CodingCactus I mean, maybe change some colors and it would be amazing