Fangames > Programming Questions
Invincibility Frames
LoneTree_tv:
I know how I could easily do invincibility frames(but describe how anyway, my way's probably wrong), but how do you make the boss toggle invisibility when it's invincible?
EDIT:
Also, how do I make an object rotate around another object?
Thanks in advance :atkHappy:
Kyir:
You would create a timer (a variable in the creation code, a variable -= 1 in the step) and then set image_alpha = 0 until the timer runs out. If you already have the code for invincibility just stick the image_alpha 0 into that one. You can also make it image_alpha = .5 for half-visible, and so on.
To be more specific, I would make invincibility frames with the following
In the Create section:
IFrame = 0;
BossHP = 100 (or whatever value you want)
In the Collide with Bullet section:
if IFrame = 0 {
BossHP -= 1;
IFrame = 20}
In the Step section:
if IFrame > 0 {
IFrame -= 1;}
I'm pretty sure that should do what you want after you change the variables to your liking, but someone else might know better than me.
LoneTree_tv:
Thanks for the help.
There's just one thing:
when I said toggling, i meant it keeps on switching between visibility and invisibility even while invincible.
Do you know how to do that?
LoneTree_tv:
I got it working with the flashing by using an inconvenient way where
I have a bunch of lines saying
if (IFrame=x) {
image_alpha=x }
or something like that, but would it work if I triggered an alarm or something that says
if (image_alpha=0) {
image_alpha=1 }
if (image_alpha=1) {
image_alpha = 0 }
if (IFrame = 0) {
image_alpha = 1
}else{
alarm[11]=20
?
LoneTree_tv:
I got it working that way. Thanks for the help :atkLove:
Navigation
[0] Message Index
[#] Next page
Go to full version