I programming in Chipmunk Basic with arrow keys, and random coordinate gen.

Click For Summary
The discussion centers on programming a game in Chipmunk Basic, specifically using the arrow keys and spacebar for controls. The user is attempting to create a simplified version of the snake game, where a line moves around the screen to collect colored dots. They express difficulty in implementing controls for the arrow keys and inquire about creating graphics and sprites in Chipmunk Basic, noting its differences from other Basic software. A suggested approach involves using the inkey$ function to detect key presses, with instructions to test the output of pressing various keys. The user also mentions encountering a type mismatch error and provides a link for further clarification on their issue. Overall, the thread focuses on troubleshooting input handling and graphics creation in Chipmunk Basic for game development.
CharlieO1212
Messages
10
Reaction score
0
I am trying to make a game in Chipmunk Basic using the arrow keys but I can't because I cannot figure out how. I have programmed in other Basic Softwares but I cannot figure out how to use the arrow keys and spacebar in my programs. An example (much simplified) of a game I am making is snake (if you don't know what it is its where a line goes around the screen and you need to come into contact with colored dots to make your "snake" bigger. If you run into yourself then the game ends). IF you know how to make graphics/sprites with colors in CB (Chipmunk Basic) then please let me know because CB is a lot different with graphics than other programs.
 
Technology news on Phys.org


Can you make this work?

while
s=inkey$
if s<>"" then print asc(s)
wend

Test that by gently pressing a single key, like X or 3.
If that works then gently press one arrow key and post the results.
For X it should print a single number.
For an arrow key it may print 1 or 2 or 3 or 4 lines of single numbers.

If that works then you need to build a little machine in software that uses the numbers.
 


It gave me a type mismatch error in line 20
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
7
Views
4K
  • · Replies 24 ·
Replies
24
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K