28 April 2016, 18:44 | #1 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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 ? |
28 April 2016, 23:06 | #2 |
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. |
28 April 2016, 23:41 | #3 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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. |
29 April 2016, 12:26 | #4 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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? |
30 April 2016, 10:54 | #5 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,357
|
AMOS doesn't count transparent parts as collisions, does it?
|
02 May 2016, 12:46 | #6 |
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. |
03 May 2016, 19:48 | #7 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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.
|
03 May 2016, 20:22 | #8 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
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. |
|
03 May 2016, 22:06 | #9 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
Thanks I did try that I will try and do a little test program but its only Sprite/Bob
|
03 May 2016, 22:21 | #10 |
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. |
14 August 2016, 09:47 | #11 |
Registered User
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. |
15 August 2016, 22:58 | #12 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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.
|
21 August 2016, 22:04 | #13 |
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 ] |
21 August 2016, 22:27 | #14 |
Glastonbridge Software
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. |
02 February 2018, 01:10 | #15 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 91
|
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.) |
18 March 2018, 23:47 | #16 |
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! |
12 April 2018, 23:22 | #17 |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
|
12 April 2018, 23:33 | #18 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,824
|
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. |
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 |
|
|