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.

Newcomers DBPro Corner / Text/Objects won't appear on screen at same time.

Author
Message
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 12th Jul 2010 09:12
Hey! I am working on a 2d game, but there is a problem. If I try to put a Healthbar on the screen the Text won't show up. If I try to put Text on the screen nothing shows up. Basically I have Player Health/Ammunition on the left side and Enemy Health/Ammunition on the right. I know how to make a working Healthbar but I do not know how to make both the text and the Healthbar show up at same time. Thanks in advance!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jul 2010 15:27
Example code? If we can see what you are doing, then it's easier to fix. If we have to guess then we've got no chance.

BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 12th Jul 2010 18:25 Edited at: 12th Jul 2010 19:27
Never mind, I spent all night toying with it and got it to work. Not exactly sure what I did but anyways, could you explain to me to make CrossHairs, lock it onto mouse, and make it transparent if I used a sprite?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jul 2010 22:09
1. Transparent sprite
Use a PNG image with transparency already set, or use a bitmap which uses a selected colour to become transparent, or draw it yourself and grab it using GET IMAGE.

2. Use the OFFSET SPRITE command to specify the sprites centre coordinates, the position it at the mousex/mousey position.

Here's a simple example:


BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 13th Jul 2010 00:29
Thanks Ian. My Healthbar does not show up now though! Like, You can see a red chunk of it following the Mouse but that is it!
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 13th Jul 2010 00:34 Edited at: 13th Jul 2010 00:37
Never mind fixed it forgot to put it within the DO/LOOP. But now the Text I have underneath the Healthbar isn't showing up...I suck so bad at doing this lol....
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jul 2010 15:39 Edited at: 13th Jul 2010 15:40
When you have sprites on the screen, unless you tell DBPro otherwise, it will clear the screen to blue after every sync. This means that as well as moving the sprites, you also need to redraw everything else, including text.

Basically, move your healthbar and the text into the loop.

[edit]The same goes for objects too.

BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 13th Jul 2010 18:29 Edited at: 13th Jul 2010 19:35
Thank you very much! That fixed everything. I can't find any tutorials on how to make a 2d shooting game that like explains what everything does, so could you maybe show me now to make it fire 1 bullet at a time and stuff? Right now if I click the bullets just drop down to 0! D'= And can you put a Timer on Text? Like make it so "Reloading.." stays up for 3 sec and make it so you can still move and stuff but not fire because Wait command freezes EVERYTHING!

Login to post a reply

Server time is: 2024-11-24 13:35:17
Your offset time is: 2024-11-24 13:35:17