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 ? |
The sprite MUST have a mask
Try Make Mask (8) Also it won't work on Hires screens. |
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. |
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? |
AMOS doesn't count transparent parts as collisions, does it?
|
Retro1234 - it would be useful to see the code of your collision detection and a breakdown of what results you are expecting.
|
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.
|
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. |
Thanks I did try that I will try and do a little test program but its only Sprite/Bob
|
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. |
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. |
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.
|
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.
https://www.youtube.com/watch?v=GRA2...ature=youtu.be |
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. |
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.) |
One more thing....
I just remembered that if it is a HIRES screen then forget bobsprite/spritebob because it'll never work! |
Quote:
:bash |
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. |
All times are GMT +2. The time now is 22:04. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.