PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Direction-PAD, Landscape mode, etc. ?

directdance · 18 Jan 2006, 10:55 UTC
Hi,

I did not found any answers to a few questions re PPL in the forum and neither in the manual.

1. Is it possible to use the direction (Joy-) pad of the pocket pc for performing e.g. moving of a sprite? If so, what is the programming code for this?

2. Does PPL support a landscape mode for displaying graphic. Of course I can draw my sprites 90 degrees araound for displaying in landscape mode but what about the integrated functions like displaying text in graphic mode?

3. Is there a code for displaying short avi´s (mpeg or divx)?

Thanks a lot !

DirectDance
Hi,

1. Yes you can do this, check out the sample program called Simple5.ppl, where you can have a character run around the screen with the direction pad.

2. This is fully supported as well. It's in the manual g_init().

3. This feature is not implemented. It might come in a later version.
directdance · 19 Jan 2006, 10:23 UTC
Hi Kornalius,

thanks for your hint re landscape mode. I found the g_init() before I asked and was confused, that this was not working on my PC. After your hint I tried it again, but this time compiling it to my pocket pc. And there it is working absoloutly great. It is only on the PC where the dimensions are changed, but it is not turned into landscape. Thanks for this !

One more question re the Sprite collide function. When I am creating sprites, I mask the invisible parts like in your examples with color G_RGB(255, 0, 255). But the collide functions are detecting collisions even on those invisible parts.

I would like to create a big sprite (320x240) for displaying a cave wher let´s say a space ship is flying around. All areas wich are alowed to fly should be color G_RGB(255, 0, 255), so invisible. But this is not working ...

Any soloutions for this ???

Thanks in advance,
DirectDance
You should add SO_PIXELCHECK to your AddSpriteOptions() or SetSpriteOptions() for each sprite you are creating. This will turn on pixel-perfect collision detection instead of bounding rectangle collision detection.

The PC doesn't support landscape yet, I will see if I can do something about it. It's a neat idea that I didn't think about.
directdance · 19 Jan 2006, 15:01 UTC
Kornalius,

the option SO_PIXELCHECK does not work correctly in my source.

I have set to sprites:


taxi$ = loadsprite(AppPath$ + "image2.bmp", G_RGB(255, 0, 255), 1, 0, NULL);
AddSpriteOption(taxi$, SO_CHECKCOLLIDE | SO_PIXELCHECK);
SetSpriteCollide(taxi$, "WELT");
SetSpriteId(taxi$, "WELT");


The second sprite does have the same parameters, only the name is diffrent. It is only a bar wich I painted a little bit longer for testing used the invisible colors.

For moving the sprite until it collides I used:


if (Collide(taxi$, x$, y$, nx$, ny$) == NULL)
MoveSprite(taxi$, x$, y$);
end;


So, the sprite is moving by pressing the direction pad until it collides. But it is even stopping moving when it collides with the invisible part of the sprite. That is looking very funny.
It should work. Both colliding sprites should have the SO_PIXELCHECK option.

Show me your init code where you load your sprites.
directdance · 20 Jan 2006, 12:44 UTC
Init Code:

Code:

taxi$ = loadsprite(AppPath$ + "t_links.bmp", G_RGB(0, 0, 255), 1, 0, NULL);
AddSpriteOption(taxi$, SO_PIXELCHECK | SO_ACCURATECHECK);
SetSpriteCollide(taxi$, "WELT");
SetSpriteId(taxi$, "WELT");
x$ = g_width / 2 - SpriteWidth(taxi$) / 2;
y$ = g_height / 2 - SpriteHeight(taxi$) / 2;

mauer$ = loadsprite(AppPath$ + "mauer.bmp", G_RGB(255, 0, 255), 1, 0, NULL);

AddSpriteOption(mauer$, SO_PIXELCHECK | SO_ACCURATECHECK);
SetSpriteCollide(mauer$, "WELT");
SetSpriteId(mauer$, "WELT");

MoveSprite(taxi$, x$, y$);
MoveSprite(mauer$, 10, 200);
That looks okay to me.

What about the code where you check for collision?

You might want to consider sending me the whole code by email, ppl @ arwen.com so I can debug it and see where we have a problem.
Hi Kornalius,

I have already sent you my source file. But while waiting for your results, I tried a little bit re the collide problem.

I changed my sprite "mauer" against your original Sprite "ball.bmp" from the bounces demo.

And voila, Pixel colission is perfect. When I resize the ball sprite using Photoshop, colission is working incorrect. When I change only a few pixels in the sprite without changing the size. It is still working ...

Which graphic program do you use for creating sprites?

Maybe the graphic file needs some special information in it ...

Cheers,
DirectDance
directdance · 21 Jan 2006, 21:41 UTC
ups ...

was not logged in 8O

The above message is from me.

Cheers,
DirectDance
Make sure your program is not dithering your image colors. You might think a pixel is black but it's not really. When you set you transparent color, this one pixel can interfere with the collision detection.
directdance · 23 Jan 2006, 01:29 UTC
No, that could not be the reason. Because when I resized your ball.bmp Sprite, the taxi sprite went thru the visible parts without activating the collide function.

But I did further tests. Sprite (Pixelcheck) Colission is working fine on my side when I am using two sprites with the same bmp file (data).

For example:

Sprite 1: bmp file with 96dpi, w=100, H=50 File=taxi.bmp
Sprite 2: bmp file with 96dpi, w=100, H=50 File=mauer.bmp

Both files include the same picture = all ok !

Sprite 1: bmp file with 96dpi, w=100, H=50 File=taxi.bmp
Sprite 2: bmp file with 96dpi, w=100, H=50 File=mauer.bmp

Both bmp files are the same size but containing diffrent content. Sprite colission is not working correct anymore.

This is why your bounces demo is working on my PC, too. All balls contains the same data.

Am I the only man having this problem ????
Am I stupid or is my PC stupid ???

Help !!!

DirectDance

Btw., if using the same pictures and setting the option:

Code:

AddSpriteOption(taxi$, SO_MIRRORX);


(but only for one Sprite), colission is not working anymore (ähmm, still working but the pixel detection is going wrong)