Hi!
I have a number of sprites, loaded by LOADANIM
how can I draw a mirrored sprite?
I tried STRETCHANIM with -1, 1 but it seems that stretch values less than 0 -> no sprite visible :(
Please, I need very fast ansver! Or I have to draw all the mirrored sprites :)
try scale = -1 in Rotozoomanim.
No, Flips upside down. It's not possible. Try creating the image again with tiles flipped.
Bad news.
Ok. meanwhile i created the mirrored tiles.
try to
mirror
image it on paint or gimp or photoshop,etc.etc.etc!
Polyvectors are great for manipulating texture coordinates.
To understand these functions, just use them exactly as if they were "DRAWSPRITE" commands.
These 3 function will mirror, vertical, horizontal, and both.
ID=0
LOADSPRITE "image.png",ID
SpriteMirrorH(ID,x,y)
FUNCTION SpriteMirrorH: num, x, y
LOCAL sW,sH,color=RGB(255,255,255)
GETSPRITESIZE num, sW,sH
STARTPOLY num , FALSE
POLYVECTOR x,y,sW,0, color
POLYVECTOR x,y+sH,sW,sH, color
POLYVECTOR x+sW,y+sH,0,sH, color
POLYVECTOR x+sW,y,0,0, color
ENDPOLY
ENDFUNCTION
FUNCTION SpriteMirrorV: num, x, y
LOCAL sW,sH,color=RGB(255,255,255)
GETSPRITESIZE num, sW,sH
STARTPOLY num , FALSE
POLYVECTOR x,y,0,sH, color
POLYVECTOR x,y+sH,0,0, color
POLYVECTOR x+sW,y+sH,sW,0, color
POLYVECTOR x+sW,y,sW,sH, color
ENDPOLY
ENDFUNCTION
FUNCTION SpriteMirrorVH: num, x, y
LOCAL sW,sH,color=RGB(255,255,255)
GETSPRITESIZE num, sW,sH
STARTPOLY num , FALSE
POLYVECTOR x,y,sW,sH, color
POLYVECTOR x,y+sH,sW,0, color
POLYVECTOR x+sW,y+sH,0,0, color
POLYVECTOR x+sW,y,0,sH, color
ENDPOLY
ENDFUNCTION
Hi again!
The question is similar: There is any built-in function to draw an anim mirrored (2 years passed, maybe a new function arised :) )? Or Hemlos's code is the preferred one?
rotozoomanim with negative scaling?
:) Same what you suggested two years ago. Ok trying now...
Nope. It's only a 180 degree rotation (because this mirrors not about a vertical line but the centerpoint of the image) :whistle:
EDIT:
Stretchanim with negative value seems to work.
DRAWANIM Bitmap%, anim%, x%, y% //draws normal anim frame
STRETCHANIM Bitmap%, anim%, x%+width%, y%, -width%, height% //draws mirrored anim frame
Im currently coding a sprite designer for GLBasic with all the trimmings and found a solution to the above question.
Zoomsprite num,x,y,-1,1 // will flip the sprite horizontally.
Nice!
I'm using StretchSprite and StretchAnim
Ive started a routine to help (with anims) within the sprite designer. Save options: save single, save anim, save reverse anim. I`m also implementing a start and finish marker so you can fine tune a anim list and also animate it.
If anyone has any ideas of what they need when designing sprites let me know. But only if Albert is fine with me asking this here.
For now I have coded the following: plot, line, circle/eiipse, box, fill, stencil (various wacky vector shapes that can be shrunk/enlarged upon the grid) flip, rotate, cut n paste, undo, clear, wrap scroll, copy/paste sprite, modify colours, animate(in progress), test screen(paste sprites on screen to see how they look - also in progress), 32x32,64x64 & 128x128 size options
It looks like DPaint in appearence and all drawing options are zoomed to fill the grid. Draw a line and you see an enlarged pixel line move around the grid etc.
Sounds good & am looking forward to seeing it =D.
By "modify colours" to you mean a palette type system or basic image processing features like brighten/darken, invert, outline etc. If it is not the latter then that would be a nice feature & save at trip to GIMP/Photoshop for little tweaks. Also the ability to use a sprite as a brush or fill pattern would be great but am getting carried away now :D
Lee
Light table to hand draw animation and possibly some sort of stencil to make it easier to colorize them.
It does look like a great Idea you should open a thread about it.
About stretchanim and zoomsprite to achieve flipped sprites:
I understand drawsprite is quite fast and that zoomsprite and rotosprite maybe a little slower on systems like caanoo.
I wonder if using stretch or zoom to a perfect negative number would yield same speed as drawsprite.
I might be able to check this on caanoo. I don´t think there would be a problem on higher systems though.
Quote from: fuzzy70 on 2012-Apr-13
Sounds good & am looking forward to seeing it =D.
By "modify colours" to you mean a palette type system or basic image processing features like brighten/darken, invert, outline etc. If it is not the latter then that would be a nice feature & save at trip to GIMP/Photoshop for little tweaks. Also the ability to use a sprite as a brush or fill pattern would be great but am getting carried away now :D
Lee
[/quote
The palette is currently 48 colours strong in 3 strips ( I dont agree with having 100s of colours on screen. A fixed number allows you plan the palette - just like in the old days :) ) that have a r,g,b ref next to them. The ref marker is surrounded by < & > buttons to reduce, increase the colours values.
The cut/paste option uses a sprite and allows it to become the brush. In this mode such options as flip, rotate, scroll etc now effect the brush and not the grid.
Your ideas to improve the fill command have been noted :) perhaps in a future version. A patterned fill could be made by using data and array commands with preset designs(a method I used early on to generate a stipple fill). A brush fill is a simple case of storing it as an data statement. I will be tinkering with this :)
I think for now a bitmap save displaying all sprites is the cheapest option with regards to GIMP etc.
Thanks for the ideas. :good:
Quote from: erico on 2012-Apr-13
Light table to hand draw animation and possibly some sort of stencil to make it easier to colorize them.
It does look like a great Idea you should open a thread about it.
About stretchanim and zoomsprite to achieve flipped sprites:
I understand drawsprite is quite fast and that zoomsprite and rotosprite maybe a little slower on systems like caanoo.
I wonder if using stretch or zoom to a perfect negative number would yield same speed as drawsprite.
I might be able to check this on caanoo. I don´t think there would be a problem on higher systems though.
The animation code currently displays each frame at natural size and large grid size. So you can click through them step by step if needed and make the odd change to the sprite.
I wont hog this thread anymore (sorry) and will soon start my own. I`ll attach a demo of the code when I reach 90% complete - currently 70%. When I started this project, I made a pen and paper list of things to do. When I tick one off I keep returning to that portion of code with new ideas. Ive now decided to abort such habits, get through the list and complete the project.
See you all soon :)
I am definitely looking forward to this :-). A wrapping scroll function is something I miss and saves a lot of messing about sometimes. Would be great to have it integrated into the IDE as well :P
Lee
Sent from my GT-I5700 using Tapatalk 2