/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Game using images?

Hi there,

**I got a task from school to code a game in JavaScript using images.**
Basically the images will look something like this:

[upl-image-preview url=https://www.webdeveloper.com/assets/files/2020-02-27/1582835888-475318-web-1920-7.png]

And if you click on **yes**, you should see a **new image as a response**.
For example, if you press “yes” you will have to choose an item:

[upl-image-preview url=https://www.webdeveloper.com/assets/files/2020-02-27/1582835953-257332-web-1920-13.png]

So my questions are these:
_1. If it’s possible to do that using images (like connect to show image 1 if yes or image 2 if no)

  • 2. If I want to use keyboard instead of onclick(), what code should I use?_
  • As an example, I want the character to move from the first block to the second block using right arrow key ->. Or go back to the last block if they press the left key <-.

    I know it might not look smooth, but I don’t have another idea of transition.
    Please help me if you know JavaScript 🙂

    to post a comment
    Full-stack DeveloperJavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @VITSUSAFeb 28.2020 — Answers are -
  • 1. Yes

  • 2. What action you want to perform, it will depend on them. [If I want to use keyboard instead of onclick() - In this sentence you did not mentioned what is your goal which you wants to perform through keyboard.
  • Copy linkTweet thisAlerts:
    @shaunmackMar 27.2020 — Thanks for your helpful response. All questions answered

    [google street view](https://ggstreetview.com)
    Copy linkTweet thisAlerts:
    @roy1234May 17.2020 — Hi, if your question is still relevant, I strongly advise you to pay attention to [https://edubirdie.com/correct-my-essay](https://edubirdie.com/correct-my-essay) and this educational platform that will help you find answers to your questions.
    ×

    Success!

    Help @antonpascu spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.26,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...