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.

DarkBASIC Professional Discussion / turn on/off object collision on the fly? doesn't appear to work.

Author
Message
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 28th Jan 2018 04:08
this doesn't work in my main loop, only seems to work once where I set it on or off outside the main loop.

SET OBJECT COLLISION OFF 3 (or ON)
do
[other code having nothing to do with collision]

if keystate(1)=16 then SET OBJECT COLLISION OFF 3
if keystate(1)=17 then SET OBJECT COLLISION ON 3

[collision checks here work, but only on the original setting set I outside the main loop.]

loop

however, hitting the keys does not change the original setting I had set outside the main loop. ie: hitting the "w" key (keystate 17) is not turning the collision on like I would expect it to.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 28th Jan 2018 04:31
Nevermind...brainfart. had the keystate numbers in the wrong places

changing to this...it works as expected.

if keystate(16)=1 then SET OBJECT COLLISION OFF 3
if keystate(17)=1 then SET OBJECT COLLISION ON 3

heh

Login to post a reply

Server time is: 2024-04-23 19:40:55
Your offset time is: 2024-04-23 19:40:55