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 / Something from nothing - using Getimage to create media (examples)

Author
Message
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 31st May 2012 05:56 Edited at: 31st May 2012 05:59
As you know, The new 107 commands allow the manipulation of images using the getImage() command.

I've been having a play around with this to see what can be done.

Before we can get to complex stuff, we need to create some primitive shapes, so I've whipped up some routines to create polygons, masks and gradients of various types.

The code is in the form of a number of self contained functions, each of which does a specific thing.

Combined, you can do all sorts of neat things with them



Absolutely no media was harmed in the making of this.

Attachments

Login to view attachments
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 31st May 2012 08:55
Really cool stuff marl
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st May 2012 11:01
That's really great work marl. Thanks for sharing!

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 31st May 2012 11:40 Edited at: 31st May 2012 11:58
Ok i updated to 1075 and wath Happened to the get image command?
One of them is missing ?

My raycaster dosent work anymore as i get unknow command errors

this used to work.

if GetImageExists( Mapimg )
DeleteImage( Mapimg )
GetImage( Mapimg , Screen_X , Screen_Y , RE_Map_X*scalex , RE_Map_Y*scaley )
else
Mapimg = GetImage( Screen_X , Screen_Y , RE_Map_X*scalex , RE_Map_Y*scaley )
endif



Iam going back to 1074 at least
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 31st May 2012 13:17
Quote: "this used to work.

if GetImageExists( Mapimg )
DeleteImage( Mapimg )
GetImage( Mapimg , Screen_X , Screen_Y , RE_Map_X*scalex , RE_Map_Y*scaley )
else
Mapimg = GetImage( Screen_X , Screen_Y , RE_Map_X*scalex , RE_Map_Y*scaley )
endif
"


Why not do this?



baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st May 2012 13:26
I'm sure that would work too but surely checking the value of a variable would be quicker than calling the getImageExists command?

Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 31st May 2012 13:44
Quote: "surely checking the value of a variable would be quicker"

Agreed, providing the variable is cleared when an image is deleted.

Otherwise there could be an old image reference in there.

Best of both worlds would be to do this


If you don't reuse the variable straight away it would be a good idea to set it to zero to prevent it passing the first check next time around
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st May 2012 13:55 Edited at: 31st May 2012 13:56
I just realised that I am commenting on your solution assuming this was the same thread I posted my solution which was this:


By ensuring the image exists from the start no check needs to be made. Since Cliff's engine uses the image every loop there's no need to worry about it not existing and therefore no need to check.

Sorry for the confusion!

EDIT: Generally speaking you are right, it's always better to reset the variable to zero if the image is deleted. Forgot to add that!

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 31st May 2012 15:49 Edited at: 31st May 2012 15:51
Thanks my friends i have actually reverted to 1074 as i cant code without the player.
My problems are mobile device speed issues

But will use your suggestions as they seam to have deleted that command anyway?

And Marl put your code snippets in the code bas!
They have added an agk section there and is easier to find when you nead it
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 20th Jun 2012 22:12 Edited at: 20th Jun 2012 22:12
Basic bubbles...



And a little project to demo it.

(it requires the earlier functions)

Result

Attachments

Login to view attachments
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 21st Jun 2012 01:43
very nice
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jun 2012 11:57
That's very neat


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

Login to post a reply

Server time is: 2024-04-27 14:29:28
Your offset time is: 2024-04-27 14:29:28