Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby BloodRaven » Sat Oct 03, 2009 8:05 am

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 :D :D :D :D .
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 ... :cry: :cry: :cry: :cry: .
Attachments
HP.rar
The rar file .....
(36.41 KiB) Downloaded 375 times
hp.jpg
Health - Top side ...
blooDRaven
User avatar
BloodRaven
 
Posts: 52
Joined: Sun Jul 26, 2009 11:53 am
Location: India
Score: 1 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby Camper1995 » Sat Oct 03, 2009 3:32 pm

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 :P
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby Fuzzy » Sat Oct 03, 2009 4:05 pm

Eliminate the actors and use an array of points.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby Chai » Sat Oct 03, 2009 6:06 pm

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

Image

Image
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby Scorpion50o1 » Sun Oct 04, 2009 3:31 am

kinda of off topic here(ok alot of topic)i beat resident evil 4 in 6days :mrgreen:
and i beat resident evil 5 in 4days :mrgreen:
OMG IM SO BORED <(^^)> (>^^)> (>^^)>
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature.
User avatar
Scorpion50o1
 
Posts: 246
Joined: Fri Apr 17, 2009 1:07 am
Location: TX
Score: 8 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby BloodRaven » Sun Oct 04, 2009 8:56 am

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 ... :shock: :shock: :shock:
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....
blooDRaven
User avatar
BloodRaven
 
Posts: 52
Joined: Sun Jul 26, 2009 11:53 am
Location: India
Score: 1 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby Scorpion50o1 » Sat Oct 10, 2009 3:37 am

forgot to mention in resident evil 4 i used just pistol and sniper.
OMG IM SO BORED <(^^)> (>^^)> (>^^)>
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature.
User avatar
Scorpion50o1
 
Posts: 246
Joined: Fri Apr 17, 2009 1:07 am
Location: TX
Score: 8 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby MrJolteon » Sat Oct 10, 2009 8:09 pm

cool HP bar
Join us on Discord!
(Download and registration not required)
User avatar
MrJolteon
 
Posts: 2266
Joined: Sat Aug 09, 2008 3:25 pm
Location: Page 400 of the interblag
Score: 100 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !!

Postby DST » Sun Oct 11, 2009 6:43 pm

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.)
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Showing Health like in RESIDENT EVIL 3 ...using canvas !

Postby next389 » Thu Nov 24, 2016 11:41 am

Played, I liked it! For a long time I can not go through all the levels))
next389
 
Posts: 10
Joined: Wed Nov 23, 2016 12:59 pm
Score: 0 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: Bing [Bot] and 1 guest