im creating a puzzle game and i need help making the first block collide with da other and so dat theres boxes which can be pushed on the floor and pads for them.
I want it so that when a pushable box lands on a pad the same color or shape, it is fixed onto the middle of it. heres my code
`turn syncronise on and set it to 40
sync on
sync rate 40
`load images
load image "cloth.bmp",1
`make the first box and color it
make object cube 1,1
color object 1,rgb(255,0,255)
set object collision to boxes 1
`make the second box and color it
make object cube 2,1
color object 2,rgb(100,150,100)
`make board
make object box 3,13,0.1,13:position object 3,0,-0.55,0
texture object 3,1
`variables
x#=-5
x2#=5
`-------------------------------------------------------------------------------------------------------------------------------------------------------------
` MAIN LOOP
`-------------------------------------------------------------------------------------------------------------------------------------------------------------
`start the main loop
do
`position the objects and cameras and point the camera
position object 1,x#,0.1,p1#
position object 2,x2#,0.1,p2#
position camera 0,10,-10
point camera 0,0,0
`set the contols for the boxes
if upkey()=1 then p1#=p1#+0.25
if downkey()=1 then p1#=p1#-0.25
if leftkey()=1 then x#=x#-.25
if rightkey()=1 then x#=x#+.25
if keystate(31)=1 then p2#=p2#-0.25
if keystate(17)=1 then p2#=p2#+0.5
if keystate(30)=1 then x2#=x2#-.25
if keystate(32)=1 then x2#=x2#+.25
`make the boundarys of the movement area
if p1#<-6 then p1#=-6
if p1#>6 then p1#=6
if p2#<-6 then p2#=-6
if p2#>6 then p2#=6
if x#=<-6 then x#=-6
if x#=>6 then x#=6
if x2#=<-6 then x2#=-6
if x2#=>6 then x2#=6
`make the collision code
if object collision(1,0)>0
position object 1,x#,0,p1#
endif
if object collision(2,0)>0
position object 2,x2#,0,p2#
endif
`syncronise and loop
sync:loop
cheers
the dark wanderer
666