Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help with boolean problem

Author
Message
Nekora
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location:
Posted: 28th Feb 2003 21:16
OKay, ive setup a array list with ships().thrust as a boolean, however an if statment which responds to the switch is not behaving as i expect. Okay heres the code.


repeat
rem Select the active ship.
shipcount = 1
array index to top Ships()
if activeship > 1
repeat
next array index ships()
inc shipcount
until shipcount = activeship
endif
cls rgb(0,0,0)
set cursor 200,200
print ships().thrust; " "; cos(wrapvalue(ships().angle))
sprite 1, 320, 240, 5
rotate sprite 1, ships().angle
if keystate(203)=1 then ships().angle = ships().angle - 5
if keystate(205)=1 then ships().angle = ships().angle + 5
if keystate(200)=1 then ships().thrust = 1
if keystate(208)=1 then ships().thrust = 0
rem This is the problem, even if thrust=1 it doesent execute ? why ?
if ships().thrust = 1
ships().xvol = ships().xvol + (cos(ships().angle+180)/ships().speed)
ships().yvol = ships().yvol + (sin(ships().angle+180)/ships().speed)
endif
starxvol = ships().xvol
staryvol = ships().yvol
angle = wrapvalue(angle)
gosub spacedust
sync
until spacekey()=1


Also, while im beggin for your mercy, i have a case statment that seemes to be fine, but wont change the ink coulor.


spacedust:
for count = 1 to 100 step 1
stars(count).lxpos = stars(count).xpos
stars(count).lypos = stars(count).ypos
stars(count).xpos = stars(count).xpos + (stars(count).speed*starxvol)
stars(count).ypos = stars(count).ypos + (stars(count).speed*staryvol)
if stars(count).xpos > 640
stars(count).lxpos = 0
stars(count).lypos = rnd(480)
stars(count).xpos = stars(count).lxpos + (stars(count).speed*starxvol)
stars(count).ypos = stars(count).lypos + (stars(count).speed*staryvol)
endif
if stars(count).xpos 480
stars(count).lxpos = rnd(640)
stars(count).lypos = 0
stars(count).xpos = stars(count).lxpos + (stars(count).speed*starxvol)
stars(count).ypos = stars(count).lypos + (stars(count).speed*staryvol)
endif
if stars(count).ypos
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2003 21:19
Use a standard integer for now - booleans are a bit buggy at the moment.
Nekora
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location:
Posted: 28th Feb 2003 22:33
Nither boolean, byte, or word will work

Login to post a reply

Server time is: 2024-11-24 04:58:37
Your offset time is: 2024-11-24 04:58:37