0
\$\begingroup\$

I have a small image (30x30 px) I want to use as a sprite on a Javascript screen to show students what Javascript can do. (They want to create games.) How do I link the image file to my Javascript program so I can work with the image as a sprite and, say, use keystrokes to move it around? I do not need any animations. A simple Javascript code example would help. Thank you from a newbie. --Jon

\$\endgroup\$
3
  • 1
    \$\begingroup\$ This seems like the kind of thing that should be fairly well served by existing beginner JavaScript game tutorials. Can you show us what you've tried based on your research so far, and where you've run into trouble that you need help with? \$\endgroup\$ Commented Dec 8, 2023 at 1:47
  • \$\begingroup\$ Thanks, DMGregory. Yes, should be, but so many code listings lack explanations and comments. I don't have anything to share because I wouldn't know where to start, and that's the problem. "Introductory" sites tell me to simply load this and then add more code to see what happens. That doesn't help me learn HOW and WHY. So, I asked ChatGPT and got a clear explanation of what goes into the HTML, CCS, and JavaScript sections and how they work together. That's the best answer so far. I'll try it. Again, thanks. --Jon \$\endgroup\$ Commented Dec 8, 2023 at 3:44
  • 2
    \$\begingroup\$ If there's a specific bit of code you find confusing, please feel free to edit your question to include that specific code (plus a link to where you found it), and ask for help understanding how/why it does what it does. The more specific you are about what you find confusing, the better users here can target their answers to be helpful for what you need. Without this, we're liable to just reproduce the same confusing examples you've already found/tried, without adding clarity. That's why it's so important to be specific about what you need help understanding. \$\endgroup\$ Commented Dec 8, 2023 at 4:07

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.