Sprite collision...

Previous topic - Next topic

MrPlow

Hi

Back again...is there a way to use sprite collision without including the transparent backgrounds?

It truly is a box then which is not ideal.

MrPlow
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

mentalthink

Hi you have "two" methods for Collision whit boxcollision or spritecoll... spritecoll give you the posibility to use a image and the collision it´s pixel perfect, only when the bullet or another thing collides between pixels you have a collision...

Boxcollide it´s like a box, you don´t have the transparency, but you can make a trick, if you have a complex figure you can add boxes tot eh perimeter or in someplaces of the objetcs...

If you don´t use too much recurses, in example 2D and 3D and physics mixed using sprcoll don´t have too much problems, it´s very faster--- but I in my game I prefer use boxcoll finally it´s more quick qhen you have a lot of things... but a lot of... and  you don´t nottice if the collision it´s just in the required point.. at least in my game runs very pretty and very smmoot the game.

Another way for make collisions it´s like Boxcoll, but whit if... basically you have to look into a  place from<> to and when you have something into this place, you make something delete or waht you want...

You can implement another kinds of collision you have to take a round whit Google... you can use Circle collision... runs very faster and it´s very easy to implement... I´m not sure but in Spaninsh forum I put somethig some time Ago,.... I don´t ebember. 

And another kind it´s the Ellipse Collision... but I never try... and I´m not sure if can be a bit Slowly...

Regards...

PS:
Example Circle Collision:
http://compsci.ca/v3/viewtopic.php?t=14897
You have a lot of examples in internet.. I rebember in the forum Gernnot write in someplace a very faster circle collision...
If you think whit calm whit circles and box, basically you cand abord any shape... the good thing it´s make yourself a tool for design Collision, and place the, like you paint a picture but for collisions.

After this you have 3D Collisions... if you need help about these... please comment us...


MrPlow

Thanks Mental!
I will look at those...SPRCOLL didnt seem pixel perf to me though unless I am using it wrong?

Circle sounds interesting...

What about the getpixel colour option?
Could i test for four corners of my sprite where transparency starts (based on size) and if the trans changes I have collision?
and the nearest object will be the collider?

Not sure if that is possible or not...
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

mentalthink

h yes you can use getpixel, but hit sprcoll you avoid to make a bit complex code... and getpixel it´s a bit slow...

Sprcoll it´s very easy to use...

You have to do something like this.

if sprcoll(spr_name_Loaded, in_pos_X , in_pos_Y                       ,  _
              spr_enemy_I_Loaded, in_her_pos_X, in_her_Y               )

//make  me something

endif...

This have to works fine...
You can see in the above code I put this Symbol _
when you have functions of a very long line, you can change to the next line putting something
  parameter1, _
and here contines the function

For me it´s more easy look more clearly the Code...