プレイ日記
HoRiz0n ClashStudios125
Can someone help me make a health bar that is like this--- 4/5 HP ■■■■[]
4そうだね
プレイ済み
返信[1]
親投稿
Nathaniel Rubixcube-solver
put this code somewhere in the loop: ?"HP "+STP$(HP)+"/5 "+"■"*HP+"[]"*(5-HP)
0そうだね
プレイ済み
返信[2]
親投稿
Nathaniel Rubixcube-solver
Oops. I meant "STR$(".
0そうだね
プレイ済み
返信[3]
親投稿
HoRiz0n ClashStudios125
Like this one →→
0そうだね
プレイ済み
返信[4]
親投稿
Aaron Krondelo
Use GFILL. Then when you lose health, decrement an amount from the length of GFILL. Since health will likely be 100 though and your GFILL coordinates will likely be entirely different, you should be able to figure out the math for that I'll let you figure that part out.
0そうだね
プレイ済み
返信[5]
親投稿
Hanzo rzsense
Refer to the following program. ACLS:GPAGE 0,4:GFILL 0,0,15,15,#YELLOW SPSET 0,0:SPOFS 0,150,200,0 SPSCALE 0,100/16,1 C=0:NHP=100:HP=100 WHILE TRUE VSYNC 1 IF C==0 THEN NHP=RND(101) C=(C+1)MOD 60 IF HP!=NHP THEN HP=HP+SGN(NHP-HP) LOCATE 19,28,0 ?FORMAT$("HP: %03D / 100",HP); SPSCALE 0,HP/16,1 WEND
1そうだね
未プレイ
返信[6]
親投稿
HoRiz0n ClashStudios125
@Hanzo this is my last post, but the HP amount & the bar are constantly changing...I did exactly what you wrote...pls help
0そうだね
プレイ済み
返信[7]
親投稿
Hanzo rzsense
Remove "IF C==0 THEN..." and "C=(C+1)MOD 60". And when you want to change the health, substitute any value for NHP (not HP) in the loop. HP (displayed health amount and length of the bar) will follow NHP in the loop.
1そうだね
未プレイ
返信[8]
親投稿
Aaron Krondelo
Come on man use your head a little, that's programming! Here I made you a simpler solution in less than 10 minutes.
1そうだね
プレイ済み
返信[9]
親投稿
raimondz raimondzz
Hi Clash, I made the game that you put on the screenshot. 'DEFINE a new sprite that display a pixel. This pixel is on the point 0,0 of the sprite sheet. SPDEF 0,0,0,1,1 VAR HP,HPMAX VAR spContainer,spBar spContainer=SPSET(0) spBar=SPSET(0) HP=50 HPMAX=100; SPSCALE spContainer,120,16 'This is important: Resize the life bar based on the current hp SPSCALE spBar,120*(hp/hpMax),16
1そうだね
プレイ済み
返信[10]
親投稿
HoRiz0n ClashStudios125
You made Friendly Pellet Rain!? OMG! So cool So is that the script for the exact same HP bar??
0そうだね
プレイ済み
返信[11]
親投稿
raimondz raimondzz
The code from above is a simple way to explain how to render the bar. On the game, the hp is on the player module while the code that handle the sprites are on other module that render the upper screen. There is one thing that I didn't put on my last post. 'Change the color of the bar to yellow. SPCOLOR spBar,&HFFEEF442
0そうだね
プレイ済み
返信[12]
親投稿
HoRiz0n ClashStudios125
Nothing is showing up
0そうだね
プレイ済み
返信[13]
親投稿
raimondz raimondzz
I guess that you didn't read this: 'DEFINE a new sprite that display a pixel. This pixel is on the point 0,0 of the sprite sheet. You need to either load a GRP that has that pixel, use other coordinate with a white pixel or use the function GPSET to draw one. Anyway, I made a small program with the HP Bar. KEY:[EXC443K4]
1そうだね
プレイ済み