| Title: | AMIGA NOTES |
| Notice: | Join us in the *NEW* conference - HYDRA::AMIGA_V2 |
| Moderator: | HYDRA::MOORE |
| Created: | Sat Apr 26 1986 |
| Last Modified: | Wed Feb 05 1992 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 5378 |
| Total number of notes: | 38326 |
ON COLLISION GOSUB HIT
COLLISION ON
OPEN"MANSTAND" FOR INPUT AS 1
OPEN"PLANTSTAND" FOR INPUT AS 2
OBJECT.SHAPE 1,INPUT$(LOF(1),1)
OBJECT.SHAPE 2,INPUT$(LOF(2),2)
CLOSE 1,2
OBJECT.X 1,77
OBJECT.Y 1,55
X=222
HI:
OBJECT.START
LOCATE 13,13
I = COLLISION(0)
J = COLLISION(I)
PRINT"J"J:PRINT"I"I
IF X > 260 THEN A = 3
IF X < 5 THEN A = 4
IF A = 3 THEN X=X-3
IF A = 4 THEN X=X+5
IF A = 0 THEN X=X-5
OBJECT.ON
OBJECT.X 2,X
OBJECT.Y 2,55
GOTO HI
HIT:
J=J+1
LOCATE 1,1
PRINT "YOU ARE HIT"
PRINT J
RETURN
The problem I am having with this program is that only the first
collision is detected and I want it to detect the object 1 everytime
object 2 is touching it. I think I will have to use a clear command
but I do not want to clear all the varibles. If you have time make
2 bobs with the object editor and type in this short program and
see if you can figure out what is wrong. Could it be this command:
OBJECT.SHAPE 2,INPUT$(LOF(2),2). The book never tells you what to
do when you have more than one object. Any ideas???????
matt
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 2473.1 | aarrrrrgggghhhhh | GUCCI::HERB | Fri Apr 14 1989 15:06 | 6 | |
If nobody has any ideas on .0 then has anybody used GFA basic,A/C
basic or HiSoft basic and could tell me if support objects better
than Amigabaic?
matt (I'm desperate!!!)
| |||||
| 2473.2 | bouncy objects | ANT::JANZEN | T - 500 picoseconds and counting | Sat Apr 15 1989 16:13 | 62 |
'4-15-89 Thomas E. Janzen for the public domain 'derived from Amiga Basic but this one works. ' 4-15-89 modified to make the objects reliably bounce off ' one another as well as off the window borders, until they ' somehow skipover the edge. ' requires two Bob objects, redthing and firstobject, in the ' directory Sources:Objects/ WINDOW 4,"animation",(110,30)-(580,170),15 ON COLLISION GOSUB bounceoff GOSUB bounceoff COLLISION ON OPEN "sources:objects/firstobject" FOR INPUT AS 1 OBJECT.SHAPE 1,INPUT$(LOF(1),1) CLOSE 1 OPEN "sources:objects/redthing" FOR INPUT AS 1 OBJECT.SHAPE 2,INPUT$(LOF(1),1) CLOSE 1 OBJECT.X 2,300 OBJECT.Y 2,100 OBJECT.VX 2,-65 OBJECT.VY 2,0 OBJECT.AX 2,0 OBJECT.AY 2,-10 OBJECT.X 1,1 OBJECT.Y 1,5 OBJECT.VX 1,65 OBJECT.VY 1,0 OBJECT.AX 1,0 OBJECT.AY 1,10 OBJECT.ON 1,2 OBJECT.START 1,2 WHILE 1 SLEEP WEND bounceoff: saveid = WINDOW(1) WINDOW 4 wounded=COLLISION(0) IF wounded=0 THEN RETURN Obstacle=COLLISION(wounded) IF Obstacle=-2 OR Obstacle=-4 THEN GOSUB wall IF Obstacle=-1 OR Obstacle=-3 THEN GOSUB floorceiling IF Obstacle=2 OR Obstacle=1 THEN GOSUB objects: OBJECT.START WINDOW saveid RETURN wall: oldvx=OBJECT.VX(wounded) OBJECT.VX wounded,-oldvx RETURN floorceiling: oldvy=OBJECT.VY(wounded) OBJECT.VY wounded,-oldvy RETURN objects: oldvx=OBJECT.VX(wounded) OBJECT.VX wounded,-oldvx oldvy=OBJECT.VY(wounded) OBJECT.VY wounded,-oldvy RETURN | |||||