forums

TNT Basic Forums > Programming Q&A
Collison problems
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-12-2003 02:20

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I want to make when sprite 138 hit sprite 134, 134 moves, but the code I have does not work ,Why?

Graphics mode 640,480
Load images 128
Load map 128
sprite 134,100,300,005
draw map section 1,1 to 20,15,0 to 10,10
draw frame

int x=300,y=300
int bx=x,by=y
sprite 138,bx,by,004
int ID=1,image=0
while not mouse button
if pressed (49)
sprite 138,x,y,004
if image =1 then bx=x-20000
if image =0 then bx=x+20000
move sprite 138,bx,by,10
if 134 = Sprite Col ( 134,138 ) then move sprite 134,1,1,10
end if

07-12-2003 05:05

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Sprite Collision

"if 134 = Sprite Col ( 134,138 ) then move sprite 134,1,1,10"

A sprite cannot collide with itself. Sprite collision takes the first number, and sees if it has collided with the second number sprite. If it has, it outputs the number ID of the sprite it has collided with.

In short, you want:

"if 138 = Sprite Col ( 134,138 )
then move sprite 134,1,1,10"

07-12-2003 06:09

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Yes but what I wanted is when a man shooting at a spider, the spider runs away, but when the bullet hits the spider, it doen't move unless the man shoot right next to the spider.

07-12-2003 15:45

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

I duuno if it makes any difference, but I always write if sprite col(34,38)=38 and it never bugs.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.