English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. AMOS (https://eab.abime.net/forumdisplay.php?f=119)
-   -   Sprite Bob Collision (https://eab.abime.net/showthread.php?t=82521)

Retro1234 28 April 2016 18:44

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
?

volvo_0ne 28 April 2016 23:06

The sprite MUST have a mask

Try Make Mask (8)

Also it won't work on Hires screens.

Retro1234 28 April 2016 23:41

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.

Retro1234 29 April 2016 12:26

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?

idrougge 30 April 2016 10:54

AMOS doesn't count transparent parts as collisions, does it?

jimwon2016 02 May 2016 12:46

Retro1234 - it would be useful to see the code of your collision detection and a breakdown of what results you are expecting.

Retro1234 03 May 2016 19:48

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.

volvo_0ne 03 May 2016 20:22

Quote:

Originally Posted by volvo_0ne (Post 1086417)
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.

Retro1234 03 May 2016 22:06

Thanks I did try that I will try and do a little test program but its only Sprite/Bob

volvo_0ne 03 May 2016 22:21

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.

JudasEZT 14 August 2016 09:47

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.

Retro1234 15 August 2016 22:58

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.

Blackgoat 21 August 2016 22:04

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

Mrs Beanbag 21 August 2016 22:27

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.

adrazar 02 February 2018 01:10

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.)

volvo_0ne 18 March 2018 23:47

One more thing....

I just remembered that if it is a HIRES screen then forget bobsprite/spritebob because it'll never work!

volvo_0ne 12 April 2018 23:22

Quote:

Originally Posted by Retro1234 (Post 1086384)
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

:bash

Retro1234 12 April 2018 23:33

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.

Page generated in 0.04676 seconds with 11 queries