"MAZE"

Hey I am creating a maze and i am having trouble with having my character making sound just when he hits the walls and ALSO I am having problems with the character going through the walls.

! Level 1
set mode"graphics"
set mode"color256"
set window 0,140,0,100
box circle 110,140,30,60
box clear 120,130,30,60

set color 173
Plot text, at 7,95: "START"
plot text, at 120,95: "CONTINUE 8==========>"
box circle 110,140,30,60
box clear 120,130,30,60
box area 0,5,100,0
box area 15,20,100,10
box area 30,35,92,45
box area 15,48,30,35
box area 0,140,2,0
box area 15,48,10,15
box area 60,70,0,60
box area 35,60,55,60
box area 30,100,92,88
box area 112,45,73,78
box area 112,117,73,100
box area 90,95,78,10
box area 80,90,40,38
box area 60,80,20,18
box area 70,80,60,58
box area 130,135,0,40
box area 135,130,55,90

plot lines:120,59;120,31
plot lines:130,59;130,31
plot lines:95,10;120,31
plot lines:120,58;116.5,74

flood 116,45
flood 133,45
flood 100,50

set color 1
flood 100,80
flood 125,50

Draw character
DO
set color 143
LET COUNT = COUNT + 2
GET KEY A
IF A = 301 then
!clear
LET y = y + 5
ELSE IF A = 304 then
!clear
LET x = x - 4.5
ELSE IF A = 303 then
!clear
LET x = x + 4.5
ELSE IF A = 302 then
!clear
LET y = y - 5
ELSE IF A = 8 then
!CLEAR
END IF
set color 173
Plot text, at 7,95: "START"
plot text, at 120,95: "CONTINUE ----->"

box area 0,5,100,0
box area 15,20,100,10
box area 30,35,92,45
box area 15,48,30,35
box area 0,140,2,0
box area 15,48,10,15
box area 60,70,0,60
box area 35,60,55,60
box area 30,100,92,88
box area 112,45,73,78
box area 112,117,73,100
box area 90,95,78,10
box area 80,90,40,38
box area 60,80,20,18
box area 70,80,60,58
box area 130,135,0,40
box area 135,130,55,90
if x<2 or y>10 and y<100 then
SOUND 900, .1
end if
if x>8 or y>10 then
SOUND 900, .1
end if

plot lines:120,59;120,31
plot lines:130,59;130,31
plot lines:95,10;120,31
plot lines:120,58;116.5,74
flood 116,45
flood 133,45
flood 100,50

set color 1
flood 100,80
flood 125,50
set color 143
IF REMAINDER(COUNT,2) = 0 THEN
DRAW Character WITH SHIFT (x,y)
ELSE IF REMAINDER(COUNT,2) <> 0 THEN
DRAW Character WITH SHIFT (x,y)
END IF
Loop until A = 13
end
Picture Character
Plot Lines: 5, 85; 10, 80; 2, 80; 5, 85;
Set Color "red"
!Flood 7.5, 97.5

End Picture

Comments

Re: Maze program ...

mrdray7 ... In any version of TrueBASIC, you need to go to the TBDEMOS folder and open the MAZE.TRU program. The remarks in this demo program teach you how to create a maze. Each time you RUN the MAZE.TRU program it creates a different maze. Regards ... Tom M