ArianeSoft - Programming and development for Windows and Windows Mobile :: Forums :: PPL - Pocket Programming Language :: Support
 
<< Previous thread | Next thread >>
SetCollisionGrid
Moderators: kornalius, bmanske, PointOfLight
Author Post
Heinz
Thu May 15 2008, 11:21am

Registered Member #114
Joined: Tue Oct 24 2006, 01:40pm
Posts: 202
I have a small side scroller demo (similar to scroll.ppl in the demo directory of ppl) and since my background images are 2000 pixels wide, I have to use the SetCollisionGrid to use sprite collisions.
The problem is, that I don't really understand the parameters of this command. The first is probably the cell size, which should be kept at 32 pixels to maintain the detection resolution I assume. Are the other two parameters the width and height of the bitmap in multiples of this cell size??
If this is the case, the standard 4096 pixels (32*128) should be more then enough for my 2000 pixel bitmap, shouldn't it? The other problem is, that if the values are too big (to be on the safe side the program crashes, when it is closed
Any hints on how to calculate the proper SetCollisionGrid paramters from the bitmap size (and Autoscrollspeed) would be highly appreciated.

regards,
Heinz
Back to top
zehlein
Thu May 15 2008, 02:23pm

Registered Member #30
Joined: Tue Sep 12 2006, 03:00pm
Posts: 449
Heinz, did you encounter any problems with the collision detection running with the default values? I never used SetCollisionGrid() myself but what I understand reading the helpfile those standard setting should be ok with you.

There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Back to top
Heinz
Fri May 16 2008, 08:52am

Registered Member #114
Joined: Tue Oct 24 2006, 01:40pm
Posts: 202
Yes, at the Pixelposition 766 (OriginX: 1917) of the background image I get a error message with the comment: "Collision grid out of bounds, use function SetCollisionGrid() to fix." That's in fact how I learned about this function
By trial and error I found now a parameter set that works on the PC, but since I don't understand the parameters, I am not sure whether it would work on other computers and PPCs as well (especially since I would expect the standard parameters to work for my example - if I understood the help properly they should cover bitmaps up to 4096 pixels, while I have only 2000 pixels in my background bitmap).

regards,
Heinz
Back to top
zehlein
Fri May 16 2008, 11:40am

Registered Member #30
Joined: Tue Sep 12 2006, 03:00pm
Posts: 449
So this seems to be for Alain to answer...

There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Back to top
kornalius
Fri May 16 2008, 02:29pm


Registered Member #1
Joined: Wed Apr 19 2006, 08:25pm
Posts: 2783
The width and height values are the number of cells horizontally and vertically. The size in pixel of each cell is specified in the first parameter. Just increase the width and height and you should be covered. You can do the following math to make sure it will never be out of collision bounds:

CellSize * Width = Max horizontal pixels allowed for collision detection.
CellSize * Height = Max vertical pixels allowed for collision detection.

Regards,
Alain Deschenes
President and programmer
ArianeSoft Inc. (http://www.arianesoft.ca)
Back to top
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System