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 Discussion / Help with correct Syntax

Author
Message
Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Nov 2002 00:23
Just wondering if anybody could tell me what the correct syntax is for have 2 numbers in between something.

IF (box2_y1
Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Nov 2002 00:24
Just wondering if anybody could tell me what the correct syntax is for have 2 numbers in between something.

IF (box2_y1 <= box1_y1 <= box2_y2) THEN colDetected = 1

Right now im trying to do some collision detection and this syntax is producing an automatic collision despite the 2 rectangles being nowhere near each other.

Help much appreciated, thanks.

Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Nov 2002 00:24
first post didnt come up properly for some reason, sorry.

TheNVS
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location: United States
Posted: 15th Nov 2002 00:44
why dont you use object collision? i would help if you tell why. so that i know what you are looking for.

Skid
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United Kingdom
Posted: 15th Nov 2002 01:10
im sure you can't lay it out like that, try

IF (box2_y1 <= box1_y1 and box1_y1 <= box2_y2) THEN colDetected = 1

or try a nested if ie,

if (box2_y1 <= box1_y1)
if (box1_y1 <= box2_y2) then colDetected = 1
endif

Skid
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 15th Nov 2002 02:24
if var>100 and var<200
perform action
endif

Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Nov 2002 10:50
The nested one works, thanks alot for the help.

Login to post a reply

Server time is: 2024-04-19 20:38:36
Your offset time is: 2024-04-19 20:38:36