Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / help with final fantasy type game

Author
Message
supersonicbdw
11
Years of Service
User Offline
Joined: 31st Oct 2011
Location:
Posted: 31st Oct 2011 18:15
im trying to make a final fantasy type game.i loaded the background and sprites but for some reason i cant make the health bars for the sprites please help me out

heres what i have so far[ This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com

`This sets up your screen refresh rate
load bitmap "My Pictures/iPod Photo Cache/john cena.bmp",0
center text 320,440, "WWE:HEROES"
center text 420,240, "Press any key to continue"
wait key
cls


load bitmap "wwe promos/wm27.JPG",0


load image "Downloads/wwe sprites/cena2 copy.bmp",2
sprite 2,1,140,2
load image "Downloads/wwe sprites/rock copy.bmp",3
sprite 3,500,140,3
sync on : sync rate 60
backdrop on : color backdrop 60
set text size 24
ink rgb(255,255,255),1






`This is your variable that you'll use for your health box
H=100
H2=100

do
`This is the health box used to increase/decrease
`H is your variable. Basically, when you add to H, the box grows and when you subtract, it decreases.
box 10,30,H,40
box 10,510,30,520
`It wouldn't be fair to have a million+ health.
`So now we add some control factors


`Now, it's not necessary to have this function, but we can limit the minimum health to 0 in the same way
If H<0
H=H+0.01
endif

`Now we make our test function, to make sure the box works.
`(Press 1 to add health)
If keystate(2)=1
`This makes H equal H+1
H=H+1
H2=H2+1
endif
`This is the subtraction of health.(for testing purposes)
`(Press 2 to decrease health)
If keystate(3)=1
H=H-1
H2=H2-1
endif

`You can also add more advanved features to your health bar. Simple, but effective
`((int(H/1))*1) This line is used to round your health to the nearest 1's place.

set cursor 5,40
print "Health "+str$((int(H/1))*1)
set cursor 1,10
print "John Cena"
set cursor 510,10
print "The Rock"
sync
loop
]
nonZero
11
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 1st Nov 2011 19:56
I haven't analyzed your code in-depth, but anyway:

1. Not a flame/criticism/judgement/smack on the head with a rolled up newspaper, but... Your code should be placed in an expandable code box (although we all slip up from time to time), especially this quantity of code. How to do this: Place "code" in square brackets, "[]" at the beginning of your code and "/code" in square brackets at the end, eg:

You'll notice the post window actually has a button for this.

2. Next, more to the point lol, you are printing to / drawing to a surface that has become invisible thanks to the use of the BACKDROP and SPRITES. You need to draw to a bitmap and then sprite those images to the screen for best results. Checkout the DBPro help section on Bitmaps, it's fairly well explained. To summarise it, a "bitmap" in this case is just a surface to draw on. It is not stored on the HDD unless you save it.

3. You could just make two sprites and stretch the one to indicate the current HP over the other which will represent the max HP.

Hope this helps. If I've said anything that's not understandable, feel free to ask as I'm not always good at explaining stuff (or so say many of my friends).

Login to post a reply

Server time is: 2022-11-27 05:19:41
Your offset time is: 2022-11-27 05:19:41