English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 28 April 2016, 18:44   #1
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
Sprite Bob Collision

Obviously I could calc it size etc but thought I'd try Sprite Bob Col but it never registers

Im using sprite 8
?
Retro1234 is offline  
Old 28 April 2016, 23:06   #2
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
The sprite MUST have a mask

Try Make Mask (8)

Also it won't work on Hires screens.
volvo_0ne is offline  
Old 28 April 2016, 23:41   #3
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
Thanks for the reply it still doesnt seem as effective as Bob/Bob Col Im using SpriteBob Col Or BobSprite Col the results are a bit random?

I dont really like using Amos only commands as there not portable but if such commands work with icons building a platformer would be easy for those that wanted to do it in such a way.

Last edited by Retro1234; 29 April 2016 at 00:00.
Retro1234 is offline  
Old 29 April 2016, 12:26   #4
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
I see this thread http://eab.abime.net/showthread.php?t=80656
is this the reason why? before I just use blocking - do you think a transparent Bob as a mask for the Sprite would have any inpact on performance?
Retro1234 is offline  
Old 30 April 2016, 10:54   #5
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
AMOS doesn't count transparent parts as collisions, does it?
idrougge is offline  
Old 02 May 2016, 12:46   #6
jimwon2016
Registered User
 
Join Date: Apr 2016
Location: Portsmouth
Posts: 24
Retro1234 - it would be useful to see the code of your collision detection and a breakdown of what results you are expecting.

Last edited by jimwon2016; 03 May 2016 at 09:44.
jimwon2016 is offline  
Old 03 May 2016, 19:48   #7
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
Hi ill put something together a little test code, it might be me trying to combine it with my current code but it does seem to work with Bob/Bob collide but not Sprite/Bob collide.
Retro1234 is offline  
Old 03 May 2016, 20:22   #8
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Quote:
Originally Posted by volvo_0ne View Post
The sprite MUST have a mask

Try Make Mask (8)

Also it won't work on Hires screens.

Sorry I wasn't thinking correctly when I typed the above.

You must make a mask for each IMAGE used by your sprites for collision to work correctly.

The easy way is to have a line near the start of your program :-

Make Mask

which will make masks for all images in the sprite bank.
volvo_0ne is offline  
Old 03 May 2016, 22:06   #9
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
Thanks I did try that I will try and do a little test program but its only Sprite/Bob
Retro1234 is offline  
Old 03 May 2016, 22:21   #10
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
from the manual.......

"Remember that all specified Sprites must be assigned to a masked image, before collision detection can work. You
are also warned that this function will only work with low resolution screens, and attempts to use it in high
resolution will lead to unpredictable results. This is because your Sprites and Bobs are likely to have different sized
screen points."

Hope this helps.
volvo_0ne is offline  
Old 14 August 2016, 09:47   #11
JudasEZT
Registered User
 
JudasEZT's Avatar
 
Join Date: May 2003
Location: mercury
Posts: 577
All variants of collisions works good on Amos. I'm using in my code and it works perfect.
As said before, first step is to use make mask command.

Next is to use SpriteBob Col(SpriteNum) ; inmediately after this, use C=Col(-1). Variable C will be the bob number which your sprite has collided with.

As commented in the (wonderful) Amos manual. The Col(-1) comprobation has to be made inmediately after SpriteBob Col.. So the bob identification will be fresh and accurate.
JudasEZT is offline  
Old 15 August 2016, 22:58   #12
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
Your right it does work - except in my main program, I cant see an obvious reason why apart from maybe screen scrolling? Ill have to explore more I had already decided this didnt work so used simple blocking and doesnt seem to gave much effect on speed anyway - but after your post decided to have another look.
Retro1234 is offline  
Old 21 August 2016, 22:04   #13
Blackgoat
Registered User
 
Join Date: Feb 2016
Location: Czech Republic
Posts: 26
Hello, I have the same problem. I use screen offset for scrolling, and apparently, if screen position is not 0,0 (upper left corner), sprite/bob collision did not work. Also, even if I "hide" sprites 6 and 7 out of screen, as manuals reccomended when using hardware scrolling, and so they are not used for computed sprites, sometimes sprite is weirdly changing colours. There is option of using direct hardware coordinates for sprite collision, but it only work witch hardware sprites, so I was left with only 6 sprites for use (1,2,3,4,5,8). Actually, with scrolling screen, I use bobs only.

[ Show youtube player ]
Blackgoat is offline  
Old 21 August 2016, 22:27   #14
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
yeah, when using 3-colour sprites, the colours depend on exactly which hardware sprite is being used (this is a feature of the hardware). When using AMOS's computed sprites you don't really get any control over that.

You could just use comparison of object co-ordinates to do collision detection manually on bounding rectangles, this is how most games do it anyway.
Mrs Beanbag is offline  
Old 02 February 2018, 01:10   #15
adrazar
Registered User
 
Join Date: Feb 2017
Location: Oslo
Posts: 90
This is a way to make Bobsprite Col work on a scrolling screen (assuming Bob Update has been turned off): Move the bob with the following instruction

Bob N,X Bob(N)-XOFFSET,Y Bob(N)-YOFFSET,

right before doing Bobsprite Col(N). Bobsprite Col(N) will now be True when a collision has occured. When the collision handling is done, the bob should be moved back in place:

Bob N,X Bob(N)+XOFFSET,Y Bob(N)+YOFFSET,


The same trick can also be used for Spritebob Col, now assuming Sprite Update is turned off:

Sprite 8,X Sprite(8)+XOFFSET,Y Sprite(8)+YOFFSET,
If Spritebob Col(8) Then ...
Sprite 8,X Sprite(8)-XOFFSET,Y Sprite(8)-YOFFSET,

(I've been struggling with Bobsprite/Spritebob Col recently, and found this thread while looking for guidance online.)
adrazar is offline  
Old 18 March 2018, 23:47   #16
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
One more thing....

I just remembered that if it is a HIRES screen then forget bobsprite/spritebob because it'll never work!
volvo_0ne is offline  
Old 12 April 2018, 23:22   #17
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Quote:
Originally Posted by Retro1234 View Post
Obviously I could calc it size etc but thought I'd try Sprite Bob Col but it never registers

Im using sprite 8
?
I know this is an old thread, but there are only 8 sprites, numbered 0-7

volvo_0ne is offline  
Old 12 April 2018, 23:33   #18
Retro1234
Phone Homer
 
Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 5,773
iirc Sprite 8 and above does all the hard work so you can have a 16 colour sprite

but this was about scrolling and sprite bob collision what adrazar wrote probably works.
Retro1234 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sprite collision help Shatterhand Coders. Blitz Basic 8 12 December 2015 23:02
Is there a Pacmania with sprite-collision disabled? Predseda request.Other 3 30 January 2012 17:10
Sprite movement and Collision Routine Blip Coders. General 35 14 February 2011 00:00
Slamtilt and RTC collision Predseda support.Games 5 22 August 2009 22:28
Bob's Bad Day - ... no Bob. AB Positive support.Games 5 16 May 2009 01:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:35.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10203 seconds with 13 queries