0

JS Game Dev

Hi i ament actually finished the game my gravity does not work i dont know where to place the blocks of code

4th Aug 2022, 11:09 AM
Linux Penguin
26 Answers
+ 2
my count meter doesnt show up either
4th Aug 2022, 1:12 PM
Linux Penguin
5th Aug 2022, 11:34 AM
Linux Penguin
+ 1
window.onload = function() { let btn = document.getElementById("jump"); let count = 0; btn.onclick = function() { count += 1; y-=25; document.onkeydown = function() { count += 1; y -= 25; } document.ontouchstart = function() { count += 1; y -= 25; } function draw() { context.clearRect(0, 0, 600, 400); context.beginPath(); context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill(); context.font = "25px Arial"; context.fillStyle = "white" content.fillText("Count: " + count, 20, 30); window.requestAnimationFrame(draw); } draw(); } } var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var x = 300; var y = 350; context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill();
4th Aug 2022, 1:12 PM
Linux Penguin
+ 1
Fixed, just that it falls on first click then proceeds up off the screen
4th Aug 2022, 3:20 PM
Linux Penguin
+ 1
This what your looking for?
5th Aug 2022, 11:34 AM
Linux Penguin
+ 1
Ooopppsss did a great debug and correcrion of my code, taught me something. Good help ๐Ÿ‘Œ
6th Aug 2022, 12:25 PM
Linux Penguin
0
None just this its a challenge, but it rewards before completion. #bugbounty
4th Aug 2022, 8:36 PM
Linux Penguin
0
Thanks
4th Aug 2022, 8:37 PM
Linux Penguin
0
window.onload = function() { let btn = document.getElementById("jump"); let count = 0; btn.onclick = function() { count += 1; y-=25; document.onkeydown = function() { count += 1; y -= 25; } document.ontouchstart = function() { count += 1; y -= 25; } function draw() { context.clearRect(0, 0, 600, 400); context.beginPath(); context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill(); context.font = "25px Arial"; context.fillStyle = "white" content.fillText("Count: " + count, 20, 30); window.requestAnimationFrame(draw); } draw(); } } var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var x = 300; var y = 350; context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill();
5th Aug 2022, 8:17 AM
Linux Penguin
0
Dont know where to put the gravity function
5th Aug 2022, 8:17 AM
Linux Penguin
0
I have published this code yesterday ill try find link
5th Aug 2022, 8:20 AM
Linux Penguin
0
Ok ill reset and learn again
5th Aug 2022, 4:41 PM
Linux Penguin
0
Request me to follow you
6th Aug 2022, 9:03 AM
Gautam Rajpurohit
0
Id like some help, let me know where im wrong
6th Aug 2022, 9:25 AM
Linux Penguin