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 / Round Sprite, square background?

Author
Message
Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 9th Oct 2012 16:21
Hi,
I have a sprite that I would like to be round, but that can accept a background from a square file so I can solve my problem form this thread http://forum.thegamecreators.com/?m=forum_view&t=200542&b=41
If I have a round sprite using my existing backdrop image, I can set the UV offset to simulate 'punching through' a platform sprite.

Any help would be appreciated!

I seek perfection but wear my scars with pride
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Oct 2012 16:50
Sadly I don't think AppGameKit has the required features for your project. For instance, if I was making a worms game, or lemmings, where I would use a big image and modify it - well I don't think I could use AGK. If I had to use AppGameKit for a project like that, I'd get helluva inventive.

Actually, I'd probably use individual sprites and go for a more organic feel - like having a boulder break up into smaller pieces that react to the other objects.
This would involve a lot of sprites and a lot of work... not sure if it's worth persuing something like that with AppGameKit, or just use C++ or even DBPro. I hope that there are plans for more image modification and access commands - ideally being able to quickly check pixel colours and paste images onto other images would solve all your woes.

Health, Ammo, and bacon and eggs!
Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 9th Oct 2012 17:41
Thanks for the response,
I will have to keep thinking : -)

I only need the illusion, as the hole will be perceived top down, then upon collision kill the colliding sprite.

My best choice is going to have a repeating pattern for the platform sprite, create the sprite with the offset backdrop, then on top of that create a sprite with the platform texture and a transparent hole, to overlay.

Not ideal, but as I was going to limit the proximity of the holes I may be able to get away with it...

I seek perfection but wear my scars with pride
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Oct 2012 17:56
Actually, something I haven't done is investigate that GET IMAGE command, I'm not sure if that can help, or if it has anything useful. Maybe the latest update has some additions to that, considering that it's quite a new feature.

If you could paste say, a bright purple circle, then grab the image, or sprite, or whatever - you might be able to specify that purple colour as transparent.

I will have a look at this tonight and let you know if I find anything that I think may be useful.

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Oct 2012 18:09 Edited at: 9th Oct 2012 18:09
I may have some ideas for this but I need to understand what you are trying to do a little better. What exactly do you want to create the holes for? What is their purpose?

If it is just visual you could possibly just use an image mask. If you want to change the collision "shape" of your platform (as I suspect) you may need to be a little more clever, perhaps by building up the shape by adding a number of box shapes. You can do this by checking for collisions with your platform pixel by pixel. It's complicated but actually pretty quick in game.

Imagine you overlay a circle on a rectangular platform and check for collisions along the platform:



this.mess = abs(sin(times#))

Attachments

Login to view attachments
Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 9th Oct 2012 19:18
I looked into image masks, but could not get my head around them enough to see if they would do the trick

My aim is to control a 'marble' sprite with getdirection, then another player creates holes to try and make the marble fall.
everything is seen from a birds eye view, so I just need the appearance of being able to see through the board to know not to steer the marble there

Visually would be fine, and then create a circle in the same place to check collision with, as there will be lots of holes being created on the fly, I am not sure manipulating the board would be feasible, an idea I have been playing with in my head

Thank you!

I seek perfection but wear my scars with pride
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 9th Oct 2012 20:18 Edited at: 10th Oct 2012 22:52
It is possible to use an image mask to cut a hole in an image, but it is very processor intensive, and GetImage() doesn't work very well on iOS devices, I'm not sure why.

If your background was a solid color, what you want to do would be very easy, but I suspect that is not the case.

I quite like the idea of assigning the same image to the "hole" as you are using as the "background", then adjusting the UV of the hole sprite so that the image matches the positioning of the background. I'm going to play around with this when I get off work tonight. Very interesting.

What you want to do sounds like spleef arena play in minecraft.

Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 10th Oct 2012 12:16
Hadn't heard of Spleef before! Don't trust myself to start playing minecraft but yes that's the general idea!

Sorry wasn't able to get to my machine last night so wasn't able to play around, could I get a quick breakdown of image masks?
Although for speed and device compatibly I am thinking it will take 2 sprites to do it rather than 1 overlaying the hole rather than punching through, I will lose the ability to have a fancy looking sprite for the 'platform'

I seek perfection but wear my scars with pride
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Oct 2012 12:31
Just thinking, what is under the holes?

If they were, lets say a sky and cloud texture, like clouds moving across the sky. Well it might be possible to use the scissor command to draw the hole sprite as a round shape rather than square.

Like for each line on the Y axis, work out the width that is required to make it round, changing the scissor each time to only draw that particular line area.

You could even have a round sprite to act as a border - maybe with edge highlights to make the holes look like they are cut out. If you can change the UV coord exactly to suit the pixel location, ignoring scaling, then the hole sprites would overlap, but you'd see the clouds through them as if they were real holes.

So, instead of cutting holes in a sprite, you'd add a backdrop sprite on top and use a custom scissor-draw routine to make it round. The ball sprite would be drawn on top of everything, it could scale down and fade out to make it look like it's falling.

I'm not sure how fast the scissor command is, but I am sure it can handle this - maybe limit the number of holes you can have, like make them shrink and close after a while... otherwise it would just grind to a crawl when there's too many holes.

Health, Ammo, and bacon and eggs!
Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 10th Oct 2012 13:37
Thanks Van!

You've given me an idea to try out...
Instead of using the scissor command, have separate sprites for each line on the y axis to make the circle, then set the uv offset accordingly.

I know AppGameKit could handle the amount of sprites, just to test if it can handle the UV offsets...

This will allow for the original of being able to have overlapping holes, and I will be able to keep the ability of a sprite as an "edge border" if the border is larger than the hole, and have the hole overlap the edge sprite, then it should still keep the visual effect.

And having the sprite scale down and fade out is a must yes

Thank you everyone! I will report back tonight

I seek perfection but wear my scars with pride
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Oct 2012 17:16
Cool. Was also thinking, maybe all the holes could be drawn with the scissor command. So rather than having a sprite for each hole, you might have an array of holes and radiuses etc, then use the scissor command to draw all the holes with 1 sprite.

The reason I'm thinking that might be a good idea, is that you'd be able to have a big backdrop, even have it bigger than the screen and scroll it... maybe even have the devices camera output work as the backdrop - so you'd see right through your tablet where there's a hole .

I want to investigate that, been thinking about some old school demo effects and how they could be replicated in AppGameKit, so this would be interesting for me. If I figure something useful out of it, I'll let you know.

Health, Ammo, and bacon and eggs!
Zeerun
AGK Developer
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 10th Oct 2012 18:43
The camera sounds a cool concept, will be interesting to see what you end up with!

Unfortunately I wouldn't be able to do it as one sprite as it is part of a multiplayer game,where holes are being added all the time, and if I were to do major changes to the sprite like that it could be buggy, if when re-scissoring a collision is missed ect.

I seek perfection but wear my scars with pride
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Oct 2012 22:16
Ohhh, have a nice workaround for this, but the UV mod commands seem to bug out - will try it with the new version of AGK. It uses a single sprite, and rotates and scales it then draws it through 360 degrees.

Health, Ammo, and bacon and eggs!
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 11th Oct 2012 00:01 Edited at: 11th Oct 2012 05:27
This thread has an example, about 5 posts down, on using image masks to cut a hole in a sprite.

It may or may not help with your current project

EDIT:

Here's something I've been playing with...



Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 11th Oct 2012 05:30
And here's the project and graphics from that hole test above. Sorry about the double post, but I wanted to include the download.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-23 23:37:57
Your offset time is: 2024-11-23 23:37:57