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 / Help 2D game Base source problems

Author
Message
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 18th Jul 2009 20:42
I am currently trying to follow Lee Bamber's videos but I am having problems such as :





Herre is the Mr Hankey.cpp


And here is the Mr Hankey.h



What am I doing wrong ? Please help!
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 18th Jul 2009 21:02
I have not seen the video, but what you are doing wrong is that you have the prototype of those functions in the errors, but you do not have them defined in the .cpp file, which would be temporarily fine if you weren't calling them here:


Just define the rest of the functions that are missing.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 19th Jul 2009 19:42
ok nice thanks
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 20th Jul 2009 11:32
Need more help, very similar error

Mr Hankey.cpp


Backdrop.cpp


Mr. Hankey


Backdrop.h


And the error



HELP please!
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 20th Jul 2009 12:21
One problem might be that you are including 'DarkSDK.h' in Backdrop.cpp, rather than 'DarkGDK.h'

level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 20th Jul 2009 12:46
same problem
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 20th Jul 2009 17:03 Edited at: 20th Jul 2009 17:08
In Backdrop.h you define two functions as:



Then you define these in Backdrop.cpp:



Change the uppercase 'B's into lowercase. The compiler is case sensitive with everything.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 20th Jul 2009 21:24
damn i hate mistakes like this thanks alot again for helping me
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 21st Jul 2009 17:37
NEW QUESTION

How can I play my game ? See the backdrop and the player ? (Just see them, haven't defined the controls yet!). When I compile the program it just says :

"Mr Hankey"
"Fart to start"

Here is the code, what am I doing wrong ?

Input.cpp


Input.h


Player.cpp



Player.h



Backdrop.cpp



Backdrop.h


Mr. Hankey.h


Mr. Hankey.cpp


I want to press space key and see the backdrop & player
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 21st Jul 2009 20:01
Don't include "DarkSDK.h", include "DarkGDK.h".

When the program gets here:



And you 'fire', g_eGameMode is set to eGameLevel. But in here:



There is no case for eGameLevel. So it does nothing.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 21st Jul 2009 20:08
Thank you yet again!
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 21st Jul 2009 21:30
I have 2 more questions if someone can answer. First my backdrop does not display correct ( as seen in the picture below ). Is there something within the code I need to change or is the picture not good ? It's a .png file, I can upload it if needed. Essentially, I must get rid of the blue gap between the sprite loop.


Second I want to move with the player left, right and so on but when I attempted to code it, again I have recieved an error. I modified Player.h and Player.cpp , rest of the code is the same as in my previous post.

Player.h


Player.cpp


Error is :


I'm sorry bu I know I am really noob.
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 21st Jul 2009 21:31 Edited at: 21st Jul 2009 21:38
Image included in this post with display error.

Edit: Does anyone know how can I print coordinates while hovering with my mouse in this 2d setup so I can place my Player accordingly ?

Attachments

Login to view attachments
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 21st Jul 2009 23:03 Edited at: 21st Jul 2009 23:03


You forgot to define those functions in Input.cpp and also need to include "Input.h" in Player.cpp. Whenever you see that error (Identifier not found), it means that the compiler has no idea what you're talking about because it has not run across code that defines it yet.

About the backdrop thing: Maybe the image is not tall enough?

To print to the screen take a look at:

C-Strings - http://www.cplusplus.com/doc/tutorial/ntcs/
sprintf - http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 3rd Aug 2009 21:22 Edited at: 3rd Aug 2009 21:31
Thank you was away on vacation, but now I have another problem loading sound if anyone can help me.Can Dark GDK load .mp3? I've tried but didn't hear anything so I converted to .wav and tried again but no luck :0. Here is the source code FULL again :

Mr. Hankey.cpp



Mr. Hankey.h


Backdrop.h


Backdrop.cpp


Player.h


Player.cpp


Input.cpp


Input.h


Sound.h


Sound.cpp



Hope someone can help me, thanks.

Edit: Problem is I don't hear anything, it gives me no error though and can run the program.
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 3rd Aug 2009 21:32 Edited at: 4th Aug 2009 02:27
No offense here, but you sound quite inexperienced with C/C++ in general. I suggest you learn C++ before Dark GDK.

And another tip. CHECK THE DOCUMENTATION I cannot stress the importance of the documentation.

But since you didn't know this time, I'll give you a free pass.

To load mp3's just use dbLoadMusic.


If you can't survive C++, THEN USE Dark Basic Pro.

OpenXDK is a homebrew kit for developing XBOX applications, but it requires a modded XBOX and is much harder then XNA.
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 3rd Aug 2009 21:38
Sounds still don't load / hear. If I wouldn't have known C++ is case sensitive I would have written everything in lower case. Yes I am noob I will turn 14 soon.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 3rd Aug 2009 21:38
A little bit of trickery can shorten your code a bit. Try something like this:


bool checkFire ( void )
{
return ( dbKeyState ( 57 ) || dbKeyState ( 29 ) || dbKeyState ( 157 ) );
}

You can do the same for your other key checks also.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 3rd Aug 2009 21:56
I am 14, but I started C++ months before, when I started Dark GDK, I wanted to make an epic FPS or something. I failed and I was about to give up, when somebody suggested I learn more C++. I found some C++ tutorials on youtube, they were a spoonfeed made by antiRTFM (just search it on youtube) and he gives you clear tutorials on C++. I honestly say it will help you, because you look like the person that needs a spoonfeed.

But seriously though, learn C++ before Dark GDK, and try to use DBPro tutorials. The syntax is somehwta similar, but you have to convert it to Dark GDK. Do that and you should become much better.

OpenXDK is a homebrew kit for developing XBOX applications, but it requires a modded XBOX and is much harder then XNA.
level
15
Years of Service
User Offline
Joined: 8th May 2009
Location:
Posted: 3rd Aug 2009 22:40
Ok.. thanks for suggestions I will go learn C++ and make a new code from scratch when I understand it better.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 4th Aug 2009 05:00
This line is the problem I think :



Your string "Assets\best.wav" is the problem, when you are passing strings in that form, the "\" character on it's own denotes an escape code, rather than the character you think. For example the code "\n" denotes a newline in the string. Im not sure off the top off my head what you are actually telling the compiler with \b , but I assume GDK will recognize it as invalid and just not process it.

There are 2 ways you can rephrase your function call to make it work :

1 -



or

2 -



The compiler will recognise what you are trying to do when it parses that string if you send it in one of these ways.

And about learning C++, I commend you on your descision. It can take many years to become properly fluent in using C++, though the basics can be picked up very quickly and built upon productively, ie. you learn while you do things, and even though you will make mistakes, as long as you learn from them, they arent really mistakes are they ?

Best of Luck

If it ain't broke.... DONT FIX IT !!!
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 4th Aug 2009 15:47
Well you don't need to know OOP (object oriented programming), but you should at least know this:

-control structures (if, else, &&, || )
-functions
-arrays
-custom data types
-variables

But this is just Dark GDK. If you're using Direct3D or OpenGL, then you do need to know more C++.

OpenXDK is a homebrew kit for developing XBOX applications, but it requires a modded XBOX and is much harder then XNA.

Login to post a reply

Server time is: 2024-10-01 10:19:56
Your offset time is: 2024-10-01 10:19:56