Windows Is it possible to code an image to invert?

B

Beersy

Guest
I was wanting to have enemies flash to invert when they take damage. I cant find a way to make the image go invert for a split second before returning to iuts normal image
 
A

Aura

Guest
Use shaders. This pack has a shader that you can use to invert colours of the sprite:

https://marketplace.yoyogames.com/assets/261/free-shaders

Use a variable and an alarm event to create a flashing effect. For instance:

Create:
Code:
hurt = false; //Set it to true whenever the player is hurt
flash = false;
Step:
Code:
if (hurt && alarm[0] < 0) {
   alarm[0] = 0.5 * room_speed;
}
else {
   flash = false;
}
Alarm 0:
Code:
flash = !flash;
Draw:
Code:
if (flash) {
   //Draw self affected by the shader
}
else {
   //Draw regular self
}
 
B

Beersy

Guest
Wait...no like for example in the game when an enemy takes damage, i was wanting to code for the enemy object to change into an inverted color for a split second. Instead of the image going :

can_hit=false
alarm[0]=10
image_blend=c_red

instead of image-blend=c_red, i was wanting the image color to go inverted instead of changing the image color...does that make better sense?
 
B

Beersy

Guest
oh cool i didnt know i can get filters to use. first time ive used this site....do they work with 8.1? or is just studio?
Use shaders. This pack has a shader that you can use to invert colours of the sprite:

https://marketplace.yoyogames.com/assets/261/free-shaders

Use a variable and an alarm event to create a flashing effect. For instance:

Create:
Code:
hurt = false; //Set it to true whenever the player is hurt
flash = false;
Step:
Code:
if (hurt && alarm[0] < 0) {
   alarm[0] = 0.5 * room_speed;
}
else {
   flash = false;
}
Alarm 0:
Code:
flash = !flash;
Draw:
Code:
if (flash) {
   //Draw self affected by the shader
}
else {
   //Draw regular self
}
 
A

Aura

Guest
Shaders are GM:S-only. If you're still using GM8.1, I would highly recommend that you upgrade to GM:S.

Or is there a reason behind that?
 
B

Beersy

Guest
Shaders are GM:S-only. If you're still using GM8.1, I would highly recommend that you upgrade to GM:S.

Or is there a reason behind that?
The reason being...all my projects are coded in 8.1...and a friend of mine said there's a lot of GML in 8.1 that doesnt work or transfer over with studio. The last time I checked studio was like a 100 dollars and havent really looked into getting it...i would love to get into studio but im not sure if i have to re learn GML for studio...i could be wrong
 

Bingdom

Googledom
Studio is free, it only costs money if you want to export your projects to other platforms(like android or ios) or release assets to the markeplace. ;)
 
B

Beersy

Guest
Studio is free, it only costs money if you want to export your projects to other platforms(like android or ios) or release assets to the markeplace. ;)
I had no idea....is there a lite studio then a standard version? cuz i have game maker 8.1 pro version that i had to purchase.
 
B

Beersy

Guest
Here's a comparison between the paid and free versions of GMS:

http://help.yoyogames.com/hc/en-us/articles/216754968-Which-Version-Of-GameMaker-Studio-Is-For-Me-

The Standard (free) version of Studio has way more features than the paid version of GM8.1, plus support for shaders that you want in this case. It doesn't have absurd limitations that the Lite version had either.

And no, you don't need to learn GML again. Slap hard whoever told you that! ^^"
The reason I say that is...he had studio and he tried to transfer one of my GM.8 games into studio, and he said some of my formulas didnt transfer over because it didnt recognize some variables..it was a long time ago i dont remember exactly what he said
 
B

Beersy

Guest
You guys are awesome! I guess i need to get into Studio...i may be the only person left using it! It would be cool to drag my fan made Mega Man game into studio and use it to clean it up.
 

RangerX

Member
Another way to have something flashing with inverted colors could be to create a sprite sheet and play it as an animation. You can create really nice flashes since your draw every frame.
 
Top