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

Click For Summary

Discussion Overview

The discussion revolves around programming in Chipmunk Basic, specifically focusing on handling input from arrow keys and the spacebar for a game project. The context includes challenges in implementing graphics and sprite handling in Chipmunk Basic, as well as generating random coordinates for game mechanics.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses difficulty in using arrow keys and the spacebar in Chipmunk Basic, drawing a parallel to a simplified version of the game Snake.
  • Another participant suggests a code snippet to test key input, proposing that if a single key works, the participant should then test the arrow keys and report the results.
  • A participant reports encountering a type mismatch error in their code, indicating a potential issue with the implementation.
  • One participant directs others to a new post for a rephrased question, indicating a desire for clarity and further assistance.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best approach to handle key inputs in Chipmunk Basic, and the discussion includes multiple perspectives on troubleshooting and coding strategies.

Contextual Notes

The discussion includes references to specific error messages and coding challenges, but does not resolve the underlying issues related to key input handling or graphics in Chipmunk Basic.

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
 

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