Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Sprite Mask

Author
Message
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 21st Aug 2020 22:55
Hi guys,

Is it possible in AppGameKit to create a sprite mask? Let's have a scenario: I have a sprite acting as a panel and a carousell of textures. If I scroll the textures in the panel, I want those textures to not slide outside the sprite panel, but to be cut by the sprite panel's edges.

Thank you!
www.alexmatei.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Aug 2020 06:19
have a look at setspritescissor()
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 22nd Aug 2020 11:41
I see your point, but we must move the sprites and then trigger a scissor
www.alexmatei.com
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Aug 2020 15:06
No you don't.
Try it and see. Set the scissor and move the sprites then see what happens.
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 22nd Aug 2020 18:59
alright, i'll try
www.alexmatei.com
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 3rd Sep 2020 14:58 Edited at: 3rd Sep 2020 14:59
is the scissoring working for multiple sprites?

Also, what's the principle behind the bounds? I don't really seem to fully understand it in order to get the bounds position correctly aligned.

Here is with what I came up:



EDIT: I believe I must expand the bounds?
www.alexmatei.com
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 3rd Sep 2020 16:33
There are two things you are doing wrong there:
Firstly; you only need to set the the sprites scissor once. You don't need to put it in the main loop.
Secondly; you have misunderstood the parameters for your scissor. Y1 is 700 and Y2 is 200. That tries to create a box with a height of minus 500 which, of course, makes no sense!

Take a look at the code below, it demonstrates two sprites being scissored by two different scissor boxes:

Login to post a reply

Server time is: 2024-04-26 16:23:22
Your offset time is: 2024-04-26 16:23:22