122-28029 Parallax Inc, 122-28029 Datasheet - Page 216

GUIDE STUDENT SMART SENSORS

122-28029

Manufacturer Part Number
122-28029
Description
GUIDE STUDENT SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-28029

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Smart Sensors
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Page 204 · Smart Sensors and Applications
If the player rapidly changes the board's tilt, it is possible to jump over the "
There are two ways to fix this. One would be to add jumping animation and call it a
"feature". Another way to fix it would be to only allow the asterisk to move by 1
character in either the X or Y directions. To fix this, the program will need to keep track
of the previous position. This is a job for the
Activity #2.
Add
TiltObstacleGameYourTurn.bs2:
x
y
xOld
yOld
Add initialization statements for
x
xOld = 10
y
yOld = 5
Modify the Main Routine so that
by an increment or decrement of 1. Repeat for
y = 10 - y
IF (x > xOld) THEN x = xOld MAX 19 + 1
IF (x < xOld) THEN x = xOld MIN 1 - 1
IF (y > yOld) THEN y = yOld MAX 9 + 1
IF (y < yOld) THEN y = yOld MIN 1 - 1
' Display asterisk at new position.
DEBUG CRSRXY, x,
PAUSE 50
xOld = x
yOld = y
' Display score
Run and test your modified program and verify that the asterisk can no longer
skip "
= 10
= 5
#
" walls.
these
VAR
VAR
VAR
VAR
variable
Word
Word
Word
Word
y, "*"
declarations
xOld
x
can only be greater than or less than
and
xOld
yOld
to
' x & y tilts & coordinates
' <--- Add
' <--- Add
' Start game char in middle
' <--- Add
' <--- Add
' Offset Cartesian -> Debug
' <--- Add
' <--- Add
' <--- Add
' <--- Add
' Display asterisk
' Pause again for blink effect
' <--- Add
' <--- Add
and
y
.
the
and
yOld
yOld
Variables
variables introduced in
.
section
#
" walls.
xOld
in

Related parts for 122-28029