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 Classic Chat / is there a way to cut sprites?

Author
Message
haliop_New
User Banned
Posted: 1st Dec 2014 05:13
i mean like fruit ninja..
is there a way ?
Blue Steel AU
AGK Developer
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location: Bundaberg, Qld, Australia
Posted: 1st Dec 2014 06:04
use 2 sprites connected via code until hit. then have them fly away / drop in any direction at any spread / and or rotation as you'd like

haliop_New
User Banned
Posted: 1st Dec 2014 06:31
well yeah i know how to do that .. but what i really want is to recreate different sprites from one sprite...
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Dec 2014 01:39
During runtime it will be tough. The only way I can think of doing it from a single image would be using masks and getImage. All very slow and you'd still have to make masks to use as the "cuts".
Best to chop it up beforehand in a sprite sheet and then just code in the random slicing. Chop each object up into 5-8 slices randomly pick 1 slice and then 1-2 pieces next to it or more!

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Dec 2014 20:02 Edited at: 2nd Dec 2014 20:40
Here's a start. Using the sprite's UV data and changing it's size you can create a form of localized clipping without any real performance hit. Once a cut is made, you would display two sprites. Drawback for the moment is making an angled cut, but I'm working on it. Not sure yet if it's possible in this manner or not.


I'm just not seeing a possible way to do the angled cuts, not without having some way of locking a sprite's rotation.


Move mouse left and right to adjust the cut. Apple rotates to show the clipping following the sprite's rotation. Apple image is attached.




"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Attachments

Login to view attachments
haliop_New
User Banned
Posted: 3rd Dec 2014 05:26
interesting approach , thank you i'll see what i can do with it
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Dec 2014 09:30
It is possible using sprite shaders. Another forum member has already got this working (I've seen his demo) but he hasn't decided whether to share or not yet.

So yes, it's possible.

You could potentially use memblocks and create new images for each cut but it would build up memory usage.
haliop_New
User Banned
Posted: 7th Dec 2014 08:08
isnt there a way with render to target?
there is a code above that cuts using uvs , you can then create a new sprite with the new uv coords , render it to image and create a new image for the new sprite.. or something..
unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 8th Dec 2014 01:26 Edited at: 8th Dec 2014 01:27
What we need is more complex UV/vertex access.

Login to post a reply

Server time is: 2024-11-25 13:20:05
Your offset time is: 2024-11-25 13:20:05