Skip to content

joystick input demo #34

@danboid

Description

@danboid

I know Clive desperately wanted the Speccy to be regarded as a "serious" business computer but as we all know, they were mainly used for games and thus I suspect many people will also be wanting to use NextBuild to write games above other forms of software. This is why I find it very odd that NextBuild somehow doesn't include any examples of how to process joystick input - not that I can see?

I presume its done in the same way as Boriel BASIC? I found this small example but it doesn't work for me under NextBuild. My USB gamepad works fine with CSpect otherwise. See the second post here for Boriel's joystick input example:

https://www.boriel.com/forum/showthread.php?tid=784

The code given for joystick input:

10 LET x=10: LET y=10
20 LET kj=IN 31: REM get the state of joystick
30 PRINT AT y,x;"*"
40 IF (kj>31) OR (kj=0) THEN GO TO 20: END IF: REM ignore spurious inputs

If I build run that code under Nextbuild, it just prints a * character and it the crashes as soon as I touch my gamepad.

It would be great if NextBuild included a demo that shows how to read input from the joystick to move a sprite around the screen. It could just be a modified version of Sources/MiniExamples/mini2.bas that uses a joystick instead of or in addition to the keyboard.

Ideally, this demo would show how the user can control a sprite with the joystick (if present) or the keyboard if Nextbuild supports this and its easy to implement. Otherwise, maybe it would be best to have the user choose the input method when the demo is run? Extra points if it shows how to read all 4 buttons on a Mega Drive controller too, or 6 buttons if that is supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions