PocketMatrix forums

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

Checking Sprite Location

Is there any function in PPL in order to find the actual pixel position a sprite is on the screen? Trying to get the screen to scroll with the sprite, and I have this to scroll it:

Code:
if(SpriteX(sprite$) > 100)
SetOriginX(OriginX - 1);
end;


However, the screen will keep scrolling once you pass the 100 mark. Is there anyway to check the physical position on the screen?

Also 2 small suggestions: the ability to flip a sprite horizontally and/or vertically, SetFlipX(sprite, true); for example.

Not sure if this is a PF thing, but could it be possible for the desktop version to be placed within a window so that they can be minimized/dragged around/etc?
Hi Sponge,

1. Use SpriteX(sprite$) - OriginX and SpriteY(sprite$) - OriginY. This will give you the real position ON SCREEN of the sprite.

You can alternatively use SetSpriteFixed(sprite$, true). The sprite will always be on screen and the SpriteX and SpriteY will be real on screen values not altered by the OriginX and OriginY.

2. Flipping sprites... Mmm, I will check if it's possible. It would serve you well for the sprites animations hein? :)

3. PF is kinda strange on the desktop. The next version will apparently allow real desktop fullscreen and different resolutions. At this point there is not much I can do but I will give a look at the PF forums to see if it's feasible.
Got it - SpriteX(sprite$) + OriginX rather than - OriginX.

Another suggestion: could SetSpriteAnimSpeed *not* reset the animation to the first frame like it seems to do now?
Hi sponge,

Oups, yeah you are right it's a - not a +. :(

I will fix SetSpriteAnim, no prob.

Btw, I have fixed the window on the PC for the GameAPI. It is now a normal window with borders and title bar with only a close box and it's position doesn't change to 0,0 when re-activated.