Page 2 of 2

Re: boss hp

PostPosted: Mon Jun 16, 2008 12:04 pm
by xr2alex99
Ty and uh
also do you know how to create an (text actor) that will show how much hp the actor has left (Enemies)
i had it kind of set up but i scrapped it after a few hours of 100% failure i had it show the max hp though it didnt change though. And my Freeze spell needs help to make the after freeze actually freeze the actor for a set # of time
Basically: if the actor touches the after freeze it will be unable to do anything at all for a amount of time (timer)

Re: boss hp

PostPosted: Mon Jun 16, 2008 12:20 pm
by DST
In Draw Actor>
textNumber=player1.hp;

Now lets make it a complete variable counter, like this:

1. take your text actor and clone it as many times as you need for whatever you want a meter of.

2. In its draw actor, put this:

switch(cloneindex){
case 0:
textNumber=player1.hp;
break;
case 1:
textNumber=any variable you wish;
break;
case 2:
same thing
break;
}

now you make as many meters as you want, and access them all from one single script.


As for freezing, its easier with player1 than it is with enemies.

Player1>collision>afterfreeze
directional_velocity=0;
EventDisable("Event Actor", EVENTKEYDOWN);
CreateTimer("Event Actor", "freezetimer", ms); //where ms is the length of the timer, in ms.

Then on player1>freezetimer
EventEnable("Event Actor", EVENTKEYDOWN);

For an enemy, you'll have to disable whatever make the enemy do stuff.
If its on a path, you have to ChangePath("Event Actor", "none", BOTH_AXIS);
if its running on timers, you have to use DestroyTimer("timername");
if it has velocity, direction_velocity=0;

Also, if its a sidescrolling game with gravity, you'll have to disable gravity temporarily too.

usually, in my draw actor, i have yvelocity+=gravity;

Then i set gravity to 1, and i can set it to 0 any time i need.