Solved Flash the screen white for a split second.

Question that is answered or resolved.

PS_VITA

Active member
Hi guys,

I've made a square sprite the size of the screen view and I'm trying to have this object appear for a few seconds and disappear as if there was a bomb blast or lightning strike when it rains.

Could someone point me in the right direction, I'm trying to some how map this flash sprite to the view ports rather than the player.

Any ideas would be truly appreciated.
 
Last edited:
You don't need to apologize :)

You can use drawmethod shortcut for that. This is my "Vision" select animation from Avengers game (without the scripts to make it easier to read):




You have to start with "drawmethod alpha 6" and with the first setting of the channel transparency, like " drawmethod channel 0.90"

This number means the alpha percentage, so 0.90 means 90% transparency.
Ahh, I am learning something new everyday.
Before, I created for more gifs for fading effects by editing the original gif with the fading effects in GIMP. This causes more resources and sizes...
Now with this fading drawmethod, it saves my time and resources, so this is absolutely great news for me!
I am more like a hands-on person, thank you so much for the example.
 
@Bruce you are welcome. There are some very useful Drawmethod shortcuts:

drawmethod scale {scalex} {scaley}

  • If scaley is not specified, it is the same as scalex. For example, drawmethod scale 1.5 will scale the whole sprite by 1.5.
drawmethod scalex {scalex} drawmethod scaley {scalex}

  • These 2 are subset of the previous scale command.
drawmethod flipx {0/1} drawmethod flipy {0/1}

  • useful to flip the frame in X or Y direction (or horizontal and vertical)
drawmethod shiftx {value}

  • Others may call that "shear" or "lean", but anyway, it is usually for gfxshadow, it is unlikely you need this. A value of 1.0 is the same as 256 in old drawmethod command.
drawmethod rotate {angle}

  • Rotate the sprite, clockwise.
drawmethod fliprotate {0/1}

  • If the rotation is affected by entity direction.
drawmethod fillcolor {color}

  • Like the old command. You can either use a raw integer value or in R_G_B format, the later has better compatibility obviously.
drawmethod remap {int}

  • Leave it alone or use -1 if you want to use current map. Don't use 0, because it means default palette.
drawmethod alpha {int}

  • Like above, use -1 or leave alone to avoid overriding.
drawmethod channel {r} {b} {b}

  • When using alpha 6, you can specify opacity for each channel (r, g or b), or leave the other 2 alone to set all the 3 channels.
  • For example the code below will grand the entity 25% opacity:
drawmethod alpha 6 drawmethod channel 0.25

drawmethod channelr {r} drawmethod channelg {g} drawmethod channelb {b}

  • These are subset of channel.
drawmethod tintmode {int} drawmethod tintcolor {color}

  • These 2 will tint the sprite with given tintcolor, in alpha mode tintmode. The color use same format as fillcolor.
drawmethod clip {x} {y} {w} {h}

  • This one is on svn but is still experimental.
    • X - Start point in x axis (horizontal)
    • Y - Start point in y axis (vertical)
    • W - Width of the cropped area (horizontal)
    • H - Height of the cropped area
  • All values starts at the IMAGE EDGE, not from the image axis, so it will start at the top left position.
The easiest way to get those values would be using OpenBORstats or other editor and draw a attackbox/body box where you want.

  • Openbor clip.png
  • Important info: Gfxshadow will still show the whole sprite, not only the cropped area. And Mirror won't show the sprite at all.
 
@Bruce you are welcome. There are some very useful Drawmethod shortcuts:

drawmethod scale {scalex} {scaley}

  • If scaley is not specified, it is the same as scalex. For example, drawmethod scale 1.5 will scale the whole sprite by 1.5.
drawmethod scalex {scalex} drawmethod scaley {scalex}

  • These 2 are subset of the previous scale command.
drawmethod flipx {0/1} drawmethod flipy {0/1}

  • useful to flip the frame in X or Y direction (or horizontal and vertical)
drawmethod shiftx {value}

  • Others may call that "shear" or "lean", but anyway, it is usually for gfxshadow, it is unlikely you need this. A value of 1.0 is the same as 256 in old drawmethod command.
drawmethod rotate {angle}

  • Rotate the sprite, clockwise.
drawmethod fliprotate {0/1}

  • If the rotation is affected by entity direction.
drawmethod fillcolor {color}

  • Like the old command. You can either use a raw integer value or in R_G_B format, the later has better compatibility obviously.
drawmethod remap {int}

  • Leave it alone or use -1 if you want to use current map. Don't use 0, because it means default palette.
drawmethod alpha {int}

  • Like above, use -1 or leave alone to avoid overriding.
drawmethod channel {r} {b} {b}

  • When using alpha 6, you can specify opacity for each channel (r, g or b), or leave the other 2 alone to set all the 3 channels.
  • For example the code below will grand the entity 25% opacity:
drawmethod alpha 6 drawmethod channel 0.25

drawmethod channelr {r} drawmethod channelg {g} drawmethod channelb {b}

  • These are subset of channel.
drawmethod tintmode {int} drawmethod tintcolor {color}

  • These 2 will tint the sprite with given tintcolor, in alpha mode tintmode. The color use same format as fillcolor.
drawmethod clip {x} {y} {w} {h}

  • This one is on svn but is still experimental.
    • X - Start point in x axis (horizontal)
    • Y - Start point in y axis (vertical)
    • W - Width of the cropped area (horizontal)
    • H - Height of the cropped area
  • All values starts at the IMAGE EDGE, not from the image axis, so it will start at the top left position.
The easiest way to get those values would be using OpenBORstats or other editor and draw a attackbox/body box where you want.

  • Openbor clip.png
  • Important info: Gfxshadow will still show the whole sprite, not only the cropped area. And Mirror won't show the sprite at all.
Great info. Does drawmethod fillcolor {color} draw the color over the whole sprites within the animation or just to the frame where we place the drawmethod fillcolor at?
As far as drawmethod remap {int}, I did not know about -1 to change back to the current palette.
If I understood this correctly. For example in my EX Mode,
I can remap the current palette to something else, then after the EX Mode is over, I can change the palette back to the previous one (current palette - which is the one we selected during the char selection screen) with the value -1, right?

Thank you very much
 
Does drawmethod fillcolor {color} draw the color over the whole sprites within the animation or just to the frame where we place the drawmethod fillcolor at?
It will last until
- you stay on the current animation
- you cancel it by using nodrawmethod

As far as drawmethod remap {int}, I did not know about -1 to change back to the current palette.
Ah no, you have to use "0", not -1, to go back to the default palette.
 
@Bruce ,
if you want another working sample of a flash on screen, the nightslashers 2019 module features flashes during pucnches and kicks - dont try and use the older version, is encrypted

i would go with DC's advice and use script tho, it is good practice to start getting used to scripting as much as you can, if you get stuck on anything (script -wise) and need more explanation dont hesitate to ask
 
It will last until
- you stay on the current animation
- you cancel it by using nodrawmethod


Ah no, you have to use "0", not -1, to go back to the default palette.
So there is no way to go back to the selected palette (the palette that is chosen during the char selection screen)?
Right now I have to save the selected palette to the entityvar in the anim select and spawn, but it is not working very well in certain situations.
I was hoping -1 would do that :-(
 
@Bruce ,
if you want another working sample of a flash on screen, the nightslashers 2019 module features flashes during pucnches and kicks - dont try and use the older version, is encrypted

i would go with DC's advice and use script tho, it is good practice to start getting used to scripting as much as you can, if you get stuck on anything (script -wise) and need more explanation dont hesitate to ask
already got it working, thank you.
 
So there is no way to go back to the selected palette (the palette that is chosen during the char selection screen)?
Yes, you can. Let me further explain

I've picked Hercules with the black/red costume:
Avengers - 0131.png
This is Hercules animation:

anim idle
loop 1
delay 60
offset 59 87
bbox 50 33 20 54
drawmethod remap 4
frame data/chars/hercules/idle1.gif
drawmethod remap 0
frame data/chars/hercules/idle2.gif
drawmethod remap 4
frame data/chars/hercules/idle3.gif
drawmethod remap -1
frame data/chars/hercules/idle4.gif

I am forcing him to use the remap 4 (brown/silver) on frames 1 and 3. On frame 2, I force him to "remap 0" (green), while in frame 4 I force him to "remap -1"
ezgif.com-gif-maker.gif
Remap 0: forces him to use the DEFAULT PALETTE (the first palette I've set on his header - green), not the one I picked.
Rempal -1: forces him to use the PALETTE I'VE PICKED at the select screen.

Got it? To revert to the palette you picked the character, you should use "-1".
 
Yes, you can. Let me further explain

I've picked Hercules with the black/red costume:
View attachment 3964
This is Hercules animation:



I am forcing him to use the remap 4 (brown/silver) on frames 1 and 3. On frame 2, I force him to "remap 0" (green), while in frame 4 I force him to "remap -1"
View attachment 3965
Remap 0: forces him to use the DEFAULT PALETTE (the first palette I've set on his header - green), not the one I picked.
Rempal -1: forces him to use the PALETTE I'VE PICKED at the select screen.

Got it? To revert to the palette you picked the character, you should use "-1".
Ahh so I understood your post about drawmethod remap -1 correctly then.
drawmethod remap 0 for default palette
drawmethod remap -1 for the palette that was selected at the char selection screen.
I just tried it and it is working like you said, thank you so much.
This openbor has so many things to learn and it is very powerful!
 
Yes, you can. Let me further explain

I've picked Hercules with the black/red costume:
View attachment 3964
This is Hercules animation:



I am forcing him to use the remap 4 (brown/silver) on frames 1 and 3. On frame 2, I force him to "remap 0" (green), while in frame 4 I force him to "remap -1"
View attachment 3965
Remap 0: forces him to use the DEFAULT PALETTE (the first palette I've set on his header - green), not the one I picked.
Rempal -1: forces him to use the PALETTE I'VE PICKED at the select screen.

Got it? To revert to the palette you picked the character, you should use "-1".
I know this drawmethod remap -1 is working fine in the entity.c.
Now I want to use this changedrawmethod(self, "remap", -1); in the shadowon script but for some reasons it is not working.
isn't this changedrawmethod(self, "remap", -1); the same as drawmethod remap -1?
One is for script and another is for the entity.c
There is also
Code:
setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, intcolourmap, int fillcolour, int rotate, int rotateflip, int transparencybg)
but I believe it has been replaced with
Code:
changedrawmethod(entity, propertyname, value);
I've even tried this
Code:
changedrawmethod(self, "remap", 2);
but is is not changing the palette.



This one works
Code:
changeentityproperty(self, "map", 2);


but then this one does not work!
Code:
changeentityproperty(self, "map", -1);



What am I doing wrong? Thanks a lot
 
isn't this changedrawmethod(self, "remap", -1); the same as drawmethod remap -1?
No, they are different things. The shortcut version "drawmethod remap -1" was made to be used directly on animations, not on scripts like that.

According to the manual, its indeed the "remap" value:
  • remap, // Defines which colourmap will be used. 0 means no colourmap. -1 means the entity(if given) will use its current colourmap.

Btw, this topic should be split since we derailed from the original subject :)
This one works
Code:
changeentityproperty(self, "map", 2);
Weird, because according to the manual, its REMAP, not MAP.
 
No, they are different things. The shortcut version "drawmethod remap -1" was made to be used directly on animations, not on scripts like that.

According to the manual, its indeed the "remap" value:
  • remap, // Defines which colourmap will be used. 0 means no colourmap. -1 means the entity(if given) will use its current colourmap.

Btw, this topic should be split since we derailed from the original subject :)

Weird, because according to the manual, its REMAP, not MAP.
I made a new topic here.
Drawmethod Scripts
Thank you
 
Back
Top Bottom