News:

Function Finder  Find all the functions within source code files

Main Menu

getimage?

Started by eatfishy, July 06, 2006, 07:37:35 PM

Previous topic - Next topic

eatfishy

I have a 96x32 pic with 3 32x32 in it. I use this code to grab the individual frame.


loadimage "player.bmp",1
getimage 1,0,0,32,32
getimage 2,32,0,64,32
getimage 3,64,0,96,32

do
drawimage 1,100,100,1
sync
loop


The image wouldn't even display on the screen. Am I using the getimage correctly?

Big C.

try the following code (not optimized!)

I've not explain the code because with the helpfiles it will be clear for you..



MyImage = LoadNewImage("MyTiles.bmp")

FrameWidth = 32
FrameHeight = 32

RenderToImage MyImage
Frame1 = GetFreeImage()
GetImage Frame1, 0, 0, FrameWidth, FrameHeight

RenderToImage MyImage
Frame2 = GetFreeImage()
GetImage Frame2, 32, 0, FrameWidth+32, FrameHeight

RenderToImage MyImage
Frame3 = GetFreeImage()
GetImage Frame3, 64, 0, FrameWidth+64, FrameHeight

RenderToScreen

DeleteImage MyImage

Cls 0

DrawImage Frame1, 50, 100, 0
DrawImage Frame2, 100, 200, 0
DrawImage Frame3, 150, 300, 0

Sync

Waitkey

eatfishy

I actually figured it out with the examples in playbasic.  I realized that rendertoscreen was missing. Big C thanks for the fast response. =)

Big C.

#3
I'm happy that you have found a solution for yourself...

If it interests you, then have a look at this Topic

eatfishy

That tile loader was very helpful. Creating a tile based game in Playbasic uses less coding than Darkbasic, which ultimately means less time. Big C., thanks again for the info... looks like I'll be chatting with you in playbasic reguarly lol

Big C.

QuoteCreating a tile based game in Playbasic

I hope you have seen the great commands for MAP creating...  ;)