@Endurion Here is the code: https://editor.p5js.org/LttntLark/sketches/IauCPtvxN
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
I'm making a 2d game, and am having a problem with one line of code.
It says script error, only because i needed to put all the files into this website. Line 32 of player.js has the broken line grayed out.
A weird environment. Anyhow, the problem is, that d ends up being “NaN”.
keyDown.A and keyDown.D are both undefined.
Try outputing values with console.log( variablename );
That shows even in that environment on the bottom left side.
@Endurion How do i do that exactly? im sorry, i just started with javascript, and the code is all from a tutorial
Ah, didn't see I can look at all the other files as well. Anyhow, settings this inside player.js works for me:
var d = 0;
if (keyDown.D)
{
d = 1;
}
if ( keyDown.A )
{
d = -1;
}
@Endurion Thanks to your help, here is the finished rough-draft of my game:
https://editor.p5js.org/LttntLark/present/IauCPtvxN