creating a sprite from pre loaded image

Started by dangerousbrian, June 29, 2005, 08:40:47 AM

Previous topic - Next topic

dangerousbrian

I've been trying for days now to turn pre drawn images into sprites with no success. Can anyone tell me why the below doesn't work? :(


LoadImage "01a.png",61;ostrich ani
LoadImage "01b.png",62;ostrich ani
LoadImage "01c.png",63;ostrich ani
LoadImage "01d.png",64;ostrich ani
LoadImage "01e.png",65;ostrich ani
LoadImage "01f.png",66;ostrich ani
; above images each 240x150 size

Cls RGB (0,0,0)
For x = 61 To 66
GetImage x,0,0,150,240
CreateSprite x
SpriteImage x,x
;  Randomly position this sprite On the screen..
 PositionSprite x,Rnd(800),Rnd(600)
  RenderToScreen
 Next x
 WaitKey

empty

#1
You don't need GetImage in your loop 'cause the images are already loaded from a file. GetImage is used to grab an area of the screen and turn it to an image.

kevin

if want sprites to be displayed, they have to be drawn..

DrawSprite        = Draw a single sprite
DrawAllSprites   = Draw all sprites
DrawOrderedSprites   = Draw sprites sorted on their Z values

empty

#3
Complete code:
PlayBASIC Code: [Select]
LoadImage "01a.png",61;ostrich ani
LoadImage "01b.png",62;ostrich ani
LoadImage "01c.png",63;ostrich ani
LoadImage "01d.png",64;ostrich ani
LoadImage "01e.png",65;ostrich ani
LoadImage "01f.png",66;ostrich ani
; above images each 240x150 size

Cls RGB (0,0,0)
For x = 61 To 66
CreateSprite x
SpriteImage x,x
; Randomly position this sprite On the screen..
PositionSprite x,Rnd(800),Rnd(600)
Next x
DrawAllSprites
Sync
WaitKey





dangerousbrian

Thanks Everyone!
WaitKey
[/code]
[/quote]