Grabbing an Image for Later Use by MikeS6th Feb 2005 11:11
|
---|
Summary Learn to Grab and create an image to be used as a texture without any external media. Description Learn to Grab and create an image to be used as a texture without any external media. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `In this tutorial, I'm going to show you how to create images with no media. `The same techniques learned here, can be used for things like capturing screenshots in game. `See the below part about our function to understand this line. cls `Clear the screen MakeImage(256,256,255,1) sync on : sync rate 60 `Setup our refresh rate make object plain 1,1,1 `Make our object texture object 1,1 `Texture our object do yrotate object 1,object angle y(1)+1 `We rotate the object for viewing purposes sync loop `This is our function. A function is a custom command that you can make. `You define the parameters as you see below. MakeImage is like our keyword `sizex,sizey, Random,and ImageNum are our integer's we use for the function. It's just like a `normal command. function MakeImage(sizex,sizey,Random,ImageNum) cls `Clear the screen to make sure everything is dark for x= 0 to sizex `We start a for-next statement to go from x to the sizex we defined above. for y= 0 to sizey dot x,y,rgb(0,rnd(Random),0) `This is where we'll make random colored dots for our image. next x `End our for-next statement here. next y `Now we grab our image from the screen and it's saved for later `use. `If you really wanted to save it, check out the 'save image' `command. get image ImageNum,0,0,sizex,sizey endfunction |