21 October 2023

Progress Review

Controller design with Pseudo Code


This is my controller design for the simple flash game "Tennis Masters". I chose to make a controller for this game because it is a free game that anyone can play online. I think this controller matches the theme of the game not just aesthetically, but functionally. Using this controller makes the game more physical. It also requires more coordination, which makes perfect sense for a sports game. Physically, the controller consists of a battery connected to the Circuit Playground Bluefruit. These components are mostly covered by a removable plastic housing that is attached to a real table tennis racket. Near the top of the handle is a potentiometer attached to the CPB.

Pseudo Code


Constant Loop:

Get accelerometer rotation (X-axis)

If rotation is greater than 3,

Keyboard Input X

Delay 1 second


If rotation is less than 0,

Keyboard Input Z

Delay 1 second


Get Sound sensor reading (subject to change)

If Sound is greater than 100

Keyboard Input Spacebar


Get Potentiometer reading

Set Potentiometer Reading to P

If P is greater than 600,

Keyboard Input Right Arrow Key

Delay (50/P) seconds

If P is less than 400,

Keyboard Input Left Arrow Key

Delay (P/500) seconds 

(this is to make the delay between inputs shorter the more you turn the knob, increasing movement speed.)



I might need to use an alternative to delay so that the player can use other inputs while moving.


 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.