rotate,animimage and handleimage

Blitz3D Forums/Blitz3D Beginners Area/rotate,animimage and handleimage

mudcat(Posted 2004) [#1]
my bmp is here http://www.geocities.com/robhydro1/
My problem is using the handleimage command and rotating my anim strip.If I set handleimage it at 0,0 or don't use it,it does fine,but if I move handleimage anywhere on the bmp,some of my rotations blink out.

here's my preload code


;*************************************
;
; rotate 90 degrees one at a time
;
;**************************************

tmp_image=LoadAnimImage("gunL.bmp",55,11,0,4)
;HandleImage tmp_image,1,0
;MidHandle tmp_image

Dim gunL(90)

For i=0 To 90
gunL(i)=CopyImage(tmp_image)
;HandleImage gunL(i),7,0
RotateImage(gunL(i),-i)
Next

And Here's how I'm rotating it

If showgunfire=1

If MilliSecs()>gunfiretimer+100
gunframe=gunframe+1
gunfiretimer=MilliSecs()
EndIf

If gunframe=4
gunframe=0
showgunfire=0
EndIf
EndIf
;HandleImage gunL(angle),0,0
DrawImage gunL(angle),x,y,gunframe



End Function


As u can see I've tryied putting the handleimage everywhere and still got the same results.

and cure for this?
Thanks,
Rob


Gauge(Posted 2004) [#2]
I'm not too familiar with handle image, but i assumed your drawing a gun with up to 90 degrees of fire, and then need the flash effect for the gun for 90 degrees, perhaps this code will work for ya? Oh i think the use of your handle image is wrong, not sure.

Your going to go with either image memory or rotatemage lag
the helpfiles says rotateimage is slow, but i've never used it.So theres two ways to do this that I know of:

1. Load an anim image with 180 frames 1 to 90 with the gun not firing, and 91 to 180 with the gun firing.
ie
gunl=LoadAnimImage("gunl.bmp",55,11,1,180)

If its not preloaded try this:

tmpimage=Loadimage("gunl.bmp")

gunl=createimage(55,55,180) ;yes 55 by 55 cause when you rotate it you'll have to read 55 by 55 i think

then to load the first 90 shots(non firing try)

for x=1 to 90
drawimage gunl,100,100
rotateimage gunl,x
grabimage gunl,100,100,x
next

then either load a new bmp with the gun firing, or add and capture a new image with the gun firing and use this loop to add 91 to 180:

for x=91 to 180 step 1
drawimage gunl,100,100 ;make sure this is the gun firing
rotateimage gunl,x
grabimage gunl,100,100,x
next

keep a current rotation of the degrees say

rot=??
fr=rot

;rot# should be 1 to 90, so if shogunfire=1 double it same ;rotation for the gunfiring

If showgunfire=1 fr=fr*2
;timer stuff
drawimage gunl,x,y,fr

Got it?

or you can use two images and use rotateimage every flip
;one firing, one not firing

gunl=loadanimimage("gunl.bmp",55,11,1,2)

fr=1 ;gunframe not firing
If showgunfire=1 fr=2 ;gunframe firing
drawimage gunl,x,y,fr
rotateimage gunl,rot

;also keep in mind
If rot<0 then rot=0
If rot>90 then rot=90

I hope that helps, If your still having problems send me your code and help ya fix it, its better if i know what exactly i'm doing. good luck


mudcat(Posted 2004) [#3]
here's what I've done to solve my problem.
i seperated my anim into 3 different bmps.Then I prerotated each one at the handleimage I needed,then just called up the drawimage I needed.(I needed the gun to rotate towards the back so it looked like it was attached to a tripod base)I didn't want to make a 320 picture anim.Yeah the help files say rotateimage is slow "IF" u try to do it real time.Just wish I knew why handleimage is screwing up for this,cause I will be using it in the future.