using the SetRotation( rotation# )
BlitzMax Forums/BlitzMax Programming/using the SetRotation( rotation# )
| ||
Can I use the SetRotation( rotation# ) to rotate an image 360 degrees? slowly? when i try i get all sorts of distorted imagery |
| ||
Graphics 800,600 Local img:tImage = LoadImage("myImage.png") MidHandleImage img Local Angle:float While Not KeyDown(Key_Escape) Cls Angle:+1 SetRotation Angle DrawImage img,100,100 Flip Wend |
| ||
That works! but its way to fast .. how would I slow it down? i am doing it on a fullscreen so its a bit blocky .. |
| ||
one more thing ... when its done rotating, if i stop the rotation at an angle, the next display is also shown incorrectly in that angle; how do I "reset" so folliowing screens are not "mis-angled? |
| ||
That works! but its way to fast .. how would I slow it down? Use a floating point value and increase it by 0.1 ( for example ) or whatever value you find gives a good speed. A little later you will probably want to read one of the guides to delta timing on this forum which enables things to run at the same speed on all machines, but for now, just using a small angle increment should suffice. Don't worry about SetRotation taking an integer, floats are automatically converted to integers, or you can do it manually if you ever need to like this : IntAngle=Int(FloatAngle) how do I "reset" so folliowing screens are not "mis-angled? SetRotation 0 |
| ||
Gabriel! Thanks man! actually a speed of + 0.01 gave me the best result and is REALLY smoothe! Love it and SetRotation 0 did the trick! I love Max, but darn I wish I had some GOOD documentation :-( Excellent support from the users though!!! |
| ||
hmmm ... ran into another problem ... i dont want to rotate the entire screen, but only a seperate image that is "on top" of the main background... how do i do that? i thought setviewport was the way, but that also affects the main background?? how do i rotate an image on top of another image? |
| ||
Psudo Code setrotation 0 drawbacground setrotation Angle drawImage Increase Angle loop Normaly I would store a seperate rotation for each image, and use setrotation either side of the draw to set, and the reset it |
| ||
you guys rock! that did it dude ;-) oh, doesnt Max have Sprites, like on the amiga and stuff? is all animations done with "drawimage()" ??? |
| ||
Yes, animation is done with "DrawImage()". Replace LoadImage() with "LoadAnimImage()". Oh, and do you use the F1 feature in MaxIDE over highlighted commands? |
| ||
Yes, I do use the F1 over the highlighted commands, but for the most case just the command and its syntax is explained; no "real" short but to the point example is shown, which would be nice |
| ||
You press F1 twice to take you to the docs for a command. |
| ||
JazziB, I think he means pressing F1F1 takes you to the command reference but there are no examples. It must be strange for newcomers that drawoval,drawrect etc have examples but nothing for loadimage/loadanimimage/drawimage. @Newbie, have you read : BlitzMax Beginner's Guide and Learning OOP in BlitzMax ? They fill a lot of gaps in the official documentation. |
| ||
@Newbie Also download Blide, (An Alternative IDE). Then you can see what functions/methods are part of (for example), an Image. ie global MyImage:TImage then when you do MyImage. all the things you can do with it (ish), pop up |
| ||
yes, I do find it strange that some commands have good and short examples, while other important commands hjave nothing but the Syntax described :-( I never heard of Blide, I will have to check that out, and thanks for the turotial links, I have gone through some of the ones in the BlitzMax Turotial forum. |