I have. You only manually use a hardcoded
drawmethod to scale in each animation. But if you want to give a whole entity a real scale in all animations without putting them in every single animation, I guarantee you that you'll have no worries about it with the use of
setdrawmethod. The one that I put them in bold are the function or command names in OpenBOR.
To further elaborate this trick using
setdrawmethod, check how many parameters
setdrawmethod has, list the names of those that are part of that function, and outline them with a number of order for each parameter like any standard/non-scripted OpenBOR command. The difference is that
setdrawmethod has 13 parameters and is a script, while the old
drawmethod has 10 and is a standard/regular/non-scripted command. The latest
drawmethod like you have there, is separate. Also, the difference is that the script has a declaration to/for a particular entity (used/declared), unlike the regular non-scripted commands that don't specify its declaration on which entity you go with. Here's how I set this method.
Number how many parameters each function has:
setdrawmethod 1 2 3 4 5 6 7 8 9 10 11 12 13
Specify what parts that are from this particular function.
setdrawmethod(entity, flag, scalex, scaley, flipx, flipy, shiftx, alpha, colourmap, fillcolour, rotate, rotateflip, transparencybg)
As in...
setdrawmethod {entity} {flag} {scalex} {scaley} {flipx} {flipy} {shiftx} {alpha} {colourmap} {fillcolour} {rotate} {rotateflip} {transparencybg}
Outline them in order for your function like this for an easier way to understand:
setdrawmethod 1 2 3 4 5 6 7 8 9 10 11 12 13
1 - entity
2 - flag
3 - scalex
4 - scaley
5 - flipx
6 - flipy
7 - shiftx
8 - alpha
9 - colourmap = color map
10 - fillcolour = fill color
11 - rotate
12 - rotateflip
13 - transparencybg
If you are using .txt files for putting your notes outside of scripts, you use # to give notes in one line like this.
Code:
# This is my note in any .txt file.
If you want to give notes in scripts, you can put a double slash ( // ) in a single line as a comment or put this tag (/* and */) for multiple lines.
Example for commenting in a single line.
Code:
// This is a comment with a double slash at the beginning. Do you get it?
Example with multiple lines with comment(s).
Code:
/*
A: Is this a single comment?
B: No, this is a multi-comment here. Do you see the slashes and stars?
A: I don't understand what you mean by that.
B: Here. You see the slash (/) and star (*) on top of this conversation, right? As well as the ending below.
A: I'm not sure.
B: It's a comment tag. Like tag-team partners. /* means the beginning of tag and */ means the ending of it. You look all the way up and down of this convo.
A: How do you make that kind of comment?
B: Easy. Start typing /* first and then type below that line (or in the same line as a single line comment) with */. Slash-star (/*) goes first, and then star-slash (*/) for end. You put your own comment between these two.
A: Hmm.. I think I'm beginning to understand a bit. So this /* to begin and this */ for make ending of main comment. I can comment between these tag parts here. Cool!
*/
setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int colourmap, int fillcolour, int rotate, int rotateflip, int transparencybg)
- Set drawmethod for an entity or define a global drawmethod for other script functions.
- entity must be a valid entity handle or an empty value.
- All other parameters are optional.
- flag defines whether the drawmethod is active, when set to 0, the drawmethod will not take effect.
- scalex defines how the sprite will be stretch in x direction: sizex = original_sizex * scalex / 256
- scaley defines how the sprite will be stretch in y direction: sizey = original_sizey * scaley / 256
- flipx defines whether the sprite will be flipped left/right. 0 means don't flip and 1 means flip.
- flipy defines whether the sprite will be flipped top/bottom. 0 means don't flip and 1 means flip.
- shiftx defines how the sprite leans, like lightx in gfxshadow feature, in most situations you don't need this.
- alpha defines which alpha blending effect will be used. 0 means no alpha effect. -1 means the entity(if given) will use its own alpha value.
- colourmap(entity only) defines which colourmap will be used. 0 means no colourmap. -1 means the entity(if given) will use its current colourmap.
- fillcolour is the colour used by the entire sprite. 0 means don't fill the sprites.
- rotate is the rotate angle(clockwise), the range is from 0 to 359.
- rotateflip(entity only) means whether the entity will flip its rotate direction if the facing is changed.
- transparencybg(screen only) means whether the screen will use transparency colour.
- Notice: In 8bit mode, fillcolour is the index in palette, otherwise, it will be a RGB value which needs to be calculate first(no system functions available now).
- Notice: For screen, transparency colour is the first colour in palette(8bit) or pure black colour(which is also 0).
- Notice: If the entity parameter is an empty value, it will change the global drawmethod, and can be used by other script functions like drawsprite or drawscreen.
This is the original form without the use of
setdrawmethod.
This one is scaled bigger with
scalex 321 and
scaley 321.
Example:
Code:
setdrawmethod(getlocalvar("self"), 1, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0);
This one is scaled with
scalex 181 and
scaley 265.
Example:
Code:
setdrawmethod(getlocalvar("self"), 1, 181, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0);
In case you're wondering how I put those kinds of values and know where to put them, for the entity part (first parameter of
setdrawmethod), I declared it as
getlocalvar("self") since it's only in one line. That's because the engine does not know what kind of entity you are declaring unless you specify which function.
getlocalvar("self") means a local entity you're gonna use. For example, I declared Necro with a one-line script and you let the engine know what you mean.
This one is without declaring a C file for the character.
Script that is declared in the character header, is an entity script. Declare an ending of a function with a semicolon (
;
) you see here. The one that is like @script and @end_script is called a script tag. The one with a value of
1 under
setdrawmethod you see below is a
flag.
Flag activates its drawmethod set ready for its change. This is a shortcut without declaring a C file.
Code:
script @script
void main()
{
setdrawmethod(getlocalvar("self"), 1, 321, 289, 0, 0, 0, 0, 0, 0, 0, 0, 0);
//setdrawmethod(entity, flag, scalex, scaley, flipx, flipy, shiftx, alpha, colourmap, fillcolour, rotate, rotateflip, transparencybg);
}
@end_script
IMO, this shortcut is good for practice as a newb, but NOT for a professional level because there will be tons of scripts to use if you knew how to do scripts.
Note that
void main() is used for non-animation scripts. Since the entity script (
script) is not an animation script, you should declare
void main.
void main should have its tags
() (parentheses) and
{} (curly brackets) for declaring any stuff. I will explain more details about animation scripts and non-animation scripts later.