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.

Dark GDK / Only last sprite displays

Author
Message
Billy Lee
16
Years of Service
User Offline
Joined: 23rd Jun 2008
Location:
Posted: 23rd Jun 2008 18:07
Does anyone know why the following code only displays the bottom sprite (the enemy life bar)? If I swap the order of those two lines, the player's life bar is displayed only. I want them both displayed at the same time.


void hudLoadSprites (void)
{
dbLoadImage ("Assets\\HUD\\lifebarback.PNG", IMAGE_LIFEBARBACK, 1);
dbLoadImage ("Assets\\HUD\\lifebarbackenemy.PNG", IMAGE_LIFEBARBACKENEMY, 1);
}


void hudDraw (void)
{
// Draw player life bar
dbSprite (SPRITE_LIFEBARBACK, 50, 50, IMAGE_LIFEBARBACK);

// Draw enemy life bar
dbSprite (SPRITE_ENEMYLIFEBARBACK, 400, 50, IMAGE_LIFEBARBACKENEMY);
}
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 23rd Jun 2008 19:02
what are the value of IMAGE_LIFEBARBACK and IMAGE_LIFEBARBACKENEMY? it looks like they are the same, which they mus tnot be
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 09:19
i don't understand these double backslashes. i just use single forward slashes.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 09:24
It needs double backslashes for a reason. You know things like \n and \b? It needs a second \ to be read as a backslash.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 09:29
i thought of that right after i hit reply...

i just save myself a few keystrokes, i guess.

"/"
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 09:45
I didn't think / works.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 09:48
i use it.

from darkrpg.cpp:
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 09:49
Huh. I would try to use \\ though for standards and just-in-case reasons.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 10:03
standards? is \\ the standard?
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 10:03
I believe so. Even in Windows Explorer, \ is used, not /.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 10:05
would an expert on the subject care to intervene?
Billy Lee
16
Years of Service
User Offline
Joined: 23rd Jun 2008
Location:
Posted: 24th Jun 2008 14:31
IMAGE_LIFEBARBACK has a value of 1 and IMAGE_LIFEBARBACKENEMY has a value of 3.

#define IMAGE_LIFEBARBACK 1
#define IMAGE_LIFEBAR 2
#define IMAGE_LIFEBARBACKENEMY 3

#define SPRITE_LIFEBARBACK 1
#define SPRITE_LIFEBAR 2

#define SPRITE_ENEMYLIFEBARBACK 1
#define SPRITE_ENEMYLIFEBAR 2
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 24th Jun 2008 17:56
Quote: "would an expert on the subject care to intervene?"


I won't claim to be an expert but I will offer that Unix/Linux use the forward slash for delimiting directories rather than a back slash (whack). Perhaps the OS (or the compiler?) is being a bit compliant for the sake of portable code as long as the context it's being used in relates to file names.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 25th Jun 2008 23:58
Quote: "#define SPRITE_LIFEBARBACK 1
#define SPRITE_LIFEBAR 2

#define SPRITE_ENEMYLIFEBARBACK 1
#define SPRITE_ENEMYLIFEBAR 2 "


i sense some interference

Login to post a reply

Server time is: 2024-11-20 15:22:25
Your offset time is: 2024-11-20 15:22:25