Quote: "ok, but can a 3d plane detect for 2d objects?"
No, sprites are different than 3D objects. It's either sprite collision or 3D collision not both.
Quote: "I'm just making this collision code off of the top of my head, would it work?"
Not really. With SPRITE HIT() it registers a hit when the sprites touch... after that it registers a SPRITE COLLISION() because the sprites are overlapping but not a SPRITE HIT() since their no longer just touching.
Quote: "that code might work if I defined width and height, how might I do that?"
You can't define the width and height of a sprite the way you want because normally the sprite size is determined by the image size. You can use LOAD IMAGE to use a pre-made image or use GET IMAGE to grab one you've drawn/manipulated in code.
The way you want to do sprite collision is a bit off. It allows the player to move till it registers a hit and it makes can_move false. But because the players movement is within an IF/THEN condition that checks if can_move is true the player can never move away from the sprite hit. Once it's false it can never be true again.
Here's one way for it to work:
sync rate 0
sync on
` Make the player
ink rgb(0,255,0),0
box 0,0,20,60
get image 1,0,0,20,60,1
` Make a wall
ink rgb(200,200,200),0
box 0,0,20,50
get image 2,0,0,20,50,1
` Create the walls
sprite 2,50,50,2
sprite 3,350,50,2
x=200:y=50
do
` Show the player
sprite 1,x,y,1
` Check for collision to reset sprite location to oldx if it's colliding at x
` This gets rid of the bumping movement of the player by the wall
if sprite collision(1,0)>0
` Reset x to oldx
x=oldx
` Show sprite again to reset
sprite 1,x,y,1
endif
` Check for left arrow
if leftkey()
` Check for no sprite collision
if sprite collision(1,0)=0
` Set oldx to current x
oldx=x
` Decrease x by 1
dec x
` Do the following if there actually is a collision
else
` Reset x to oldx
x=oldx
endif
endif
` Check for right arrow
if rightkey()
` Check for no sprite collision
if sprite collision(1,0)=0
` Set oldx to current x
oldx=x
` Increase x by 1
inc x
` Do the following if there actually is a collision
else
` Reset x to oldx
x=oldx
endif
endif
sync
loop