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 / For x delete collision problame pls hlp

Author
Message
Csens
10
Years of Service
User Offline
Joined: 9th May 2015
Location:
Posted: 9th May 2015 19:41
Hi all pls help!
I know what command to delete the object point at which it encounters(collision)?

obj=15
For x = 10 to obj
Make object sphere x,5
Position object x,Rnd(300),0,Rnd(300)
Next x
*************************************
my code is wrong :
if object collision (ship,x) then delete object x
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th May 2015 01:47
For future reference you should probably be posting this in the Newcomers Board.

Anyway, to answer your question, I'll ask you one (): what value do you think "x" has in this statement?





Powered by Free Banners
Csens
10
Years of Service
User Offline
Joined: 9th May 2015
Location:
Posted: 11th May 2015 17:42
the program looks like this:

Sync on
sync rate 40
hide mouse
set display mode 1280,1024,32
set global collision on

global objektek
global obj

ship=1
rem load player
Load object "obj/ship.3DS",Ship
load image "obj/ship.jpg",Ship

scale object 1,50,50,50
texture object 1,1
position object 1,200,0,50
obj=15
objektek()


rem enemy
make object cube 2,5
position object 2,300,0,0
rem camera
position camera 160,350,140
rotate camera 90,0,0




life=100
do
text 20,20, "Life:"+str$(life)
text 20,50, "Score:"+str$(score)



Distance1 = Distance1 - 1.5
Turn = rnd(360)
Move object 2,5


if Distance1 < -50
yrotate object 2, wrapvalue(object angle Y(2) + Turn)
Distance1 = 0
endif
if object screen x(2)<0 then turn object right 2,180
if object screen x(2)>1280 then turn object left 2,180
if object screen y(2)<0 then pitch object down 2,180
if object screen y(2)>1000 then pitch object up 2,180

If Object collision(ship,2) then life=life-2

if object collision (ship,0)>0 then score=score+1

if object collision (ship,x)>0 delete object x





`get keyboard input to change the y variable
if rightkey()=1 then y=wrapvalue(y+5)
if leftkey()=1 then y=wrapvalue(y-5)

`move the object
if upkey()=1 then move object 1,5
if downkey()=1 then move object 1,-5



`yrotate the box
yrotate object 1,y

`update the screen

sync

loop


function objektek
For x = 10 to obj
Make object sphere x,5
Position object x,Rnd(300),0,Rnd(300)
Next x
endfunction
Csens
10
Years of Service
User Offline
Joined: 9th May 2015
Location:
Posted: 11th May 2015 17:50
I want to just delete it and only objects which conflicts with x
but do not want to succeed and the second object is deleted: S

thx
Csens
10
Years of Service
User Offline
Joined: 9th May 2015
Location:
Posted: 11th May 2015 18:02
During solved
if object collision (ship,x)>3 then delete object object collision (ship,x)

Login to post a reply

Server time is: 2025-05-13 21:55:18
Your offset time is: 2025-05-13 21:55:18