Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sat Oct 03, 2009 8:05 am
by BloodRaven
Hi friends .. when i played Resident evil 3 they are showing the health like in Hospitals ....Now i am trying to create one like that.Here is my first demo on this....It is not completed becoz i am using different actors ; it requires more than 10 of them to complete.
In this source file i used different 10 actors [ hidden ] and one player and one enemy .You can move the player using the arrow keys..The health is shown on the top side..
There is a canvas ; i used it to draw line through the hidden characters i named it as lifespots.The hidden actors are too small even you can't see them after changing the transparency
.
The health is reducing when the actor collide with the enemy ; when it happens then the top lifespots will comedown and down spots will come up.When all spots comes same level then the actor will be destroyed ....
Please play it and give any new ideas to improve it .....I think if you helped me then it will become a nice and real looking one.
I need your help to reduce the no. of Actors.I tried to create it as clones ; but i can't draw line connecting all of them ; becoz i don't know how to get a particular clone from the list ...
.
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sat Oct 03, 2009 3:32 pm
by Camper1995
Wow! Good job!
Maybe you can add some effects, when you touch enemy. Because when I am not looking at
that "health" line, I don't see that something is happened with that line
Camper
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sat Oct 03, 2009 4:05 pm
by Fuzzy
Eliminate the actors and use an array of points.
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sat Oct 03, 2009 6:06 pm
by Chai
wow this looking good, and you really good with code
but in my oppinion if you use Image Sprites of Health line
it will be easier and more beautiful,
and I believed that Resident evil game
they still use Image Sprites for Health status
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sun Oct 04, 2009 3:31 am
by Scorpion50o1
kinda of off topic here(ok alot of topic)i beat resident evil 4 in 6days
and i beat resident evil 5 in 4days
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sun Oct 04, 2009 8:56 am
by BloodRaven
Fuzzy wrote:Eliminate the actors and use an array of points.
Yes it is necessary .. then only i can make it more good ...but i don't know how to get one particular clone or points ....Please help me with that ....
And for Chai , yes you are right but image spirits are lot in my game already hehehe ...
now the game is finished only 30 % but memory is become 69 MB ... In case of canvas i can use different colors ,
if life is reduced then i can change the line color from green to red and for any super health then i can add or move up the spots then the life become large display ...In case of spirits then i need them for Normal , medium , low , and super ,etc ...
Hey I am trying to make some effects .... but it is still under experiment .Now i am looking on real time water effects...
Camper1995 please look that health when you hit continuously with that enemy .... the line will become low ...... hehehehe for Scorpion hehehehehe it is not off topic .....and if you finished 4 then i finished resident evil 3 Hard within 1:40 hrs without any saves ...hehehehe....
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sat Oct 10, 2009 3:37 am
by Scorpion50o1
forgot to mention in resident evil 4 i used just pistol and sniper.
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!
Posted:
Sun Oct 11, 2009 6:43 pm
by DST
lol i started off using actors for points on a canvas when i first started, until i realized something....
i could do it just as easily with an array of points, like fuzz said. in fact, even easier!
So i'd have two arrays, of floats (real).
linex[20];
liney[20];
and set them at the start to whatever i wanted them to be (the heartbeat lines), then i'd have offset variables;
xoffset; and yoffset;
Then draw the lines from a loop, like this:
moveto(linex[0]+xoffset, liney[0]+yoffset); //this puts you at the start of the meter
for(i=0; i<20; i++){
lineto(linex[i]+xoffset, liney[i]+yoffset); //no moveto's needed, the turtle stays where you last drew a line to
}
and so every time the player gets hit, run another loop to change the numbers, this is even simpler:
player>collision>enemy>
float healthpercent;
health-=collide.damage; //subtract enemy damage from health
healthpercent=(health/maxhealth);
for(i=0; i<20; i++){
liney[i]*=healthpercent;
}
Of course, the linex coords don't change, unless you ...want them to! Consider that you can make the heartbeat scroll past, like a real EKG machine does, by running a loop in canvas's draw actor:
for(i=0; i<20; i++){
linex[i]-=1; if(linex[i]<=0){
linex[i]=40; } //where 40 is the width of the health meter.
}
Then, to get rid of the '1 frame behind view' glitch that the canvas has, don't use parenting, instead use direct coordinates, starting in player script.
player>draw actor>
view.x=x-vxoffset;
view.y=y-vyoffset; //where the offsets would decide what part of the screen the player is in, for instance you can set on player>createactor>
vxoffset=view.width/2;
vyoffset=view.height/2;
//and the player will stay in the center of the screen. Then do the same to sync the canvas to player's position too.
Since a program calculates all scripts, and THEN outputs the view frame, if you tell view and canvas where to be in player's draw actor, they will update properly, and nothing ever gets 'left behind one frame'.
With canvas, you've got two coords going; first the canvas draws to the spot you specify, then the parenting tells it to translate those coordinates to move with view. The dual translation results in lag even when parenting is used, its not a glitch or a problem in ge: You are actually outputting the canvas coords 1 frame too late.
But if player tells canvas to move, canvas is already in the right spot before it even begins to draw anything.
ANd then of course, using the array loop, your entire canvas draw script will be reduced to 10 lines of code, no matter how many meters you want to draw.
It also makes it easier to add lighting fx, such as two mirror loops, one above and below the current meter.
The one below is drawn with larger lines but at a transp of .75;
while the one above is drawn with smaller, brighter lines, almost white. Now you've got some lighting fx, as well as antialiasing of a sort on your canvas meter. (and you can work them all into one single loop if you like, though it would require a constant setpen command, which might slow things down more than having 3 loops.)
Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !
Posted:
Thu Nov 24, 2016 11:41 am
by next389
Played, I liked it! For a long time I can not go through all the levels))