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 / darkGDK.h include problem

Author
Message
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 21st Jan 2012 18:28
for most of my classes darkGDK.h works as usual but for one of them which ive set out the same as anything else when i call the darkGDK commands nothing happens. ive tested that the class has been initialized and ive made an array and filled it with data but the db commands (dbLine and dbSprite do not do anything to the game world.

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jan 2012 20:10
dbLine may be a problem with the update. I've had problems with the 2D functions.... But, dbSprite should still work. Double check your code and then post the applicable parts.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 22nd Jan 2012 02:35




none of the db commands in this come up everything else works ive put break points in it to debug and make sure there is values for everything.

Dar13
11
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 22nd Jan 2012 03:13
@hookkshot
Can we see your main loop, or how the class is used at least?

hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 22nd Jan 2012 03:54
in the main loop i creat a projectile object each loop i use the Update() and Draw() functions

when the projectile is created i use the Init() to put values in everything.




in this code the projectile class does get created i use testII to to debug making sure the code is going through and it is. i also checked the value of each projectile i create and all data is being filled with values

its just the db command that don't work in it

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 22nd Jan 2012 20:27
I don't see where you assign a value to "projectile.sprite" or more specifically entities.sprite

The code you just posted tells me nothing about creation or update. Post the code that you use to make the projectiles and the code that calls the update.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 23rd Jan 2012 06:51 Edited at: 23rd Jan 2012 06:54
sorry i seem to of pasted the wrong thing




that is where its created



Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 23rd Jan 2012 14:30
It looks like your only making one projectile.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 23rd Jan 2012 16:30
well its in a loop

but the rest of the loop doesnt effect projectiles

its the loop of each unit in the game currently

testing to see if they can fire or not

either way nothing shows up.

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 23rd Jan 2012 22:20
What are you declaring "projectiles" as?

Your "projectile" storage class has no "at(i)"...

It may be easier if you post your entire code.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 24th Jan 2012 03:13
declared as vector <projectile> projectiles;

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jan 2012 13:48
You have a class named "projectile". Is that the class for "projectiles" or is "projectiles" of class "entity"?

It may be easier if you post your entire code.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 24th Jan 2012 15:31
my code is quite big

projectile is a class

projectiles is a vector of the projectile class

ill try and filter out some code but what ive posted is the stuff that intereacts with projectiles and the problem is getting the class projectile to work because i can do that its that in the class the db functions dont seem to do anything.

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jan 2012 19:08
Looking at your projectile class, I see that projectile looks like a funtion-- not a vector.

There is a common problem I have been seeing lately-- labeling. You are not the only one I've seen doing this. When you make a class or even a function, you don't make a point to distinguish them from variables. At a quick glance I can't tell the difference between "projectile" and "projectiles". When these are given without context, it's easy to confuse them. This is entirely up to you if you want to keep doing things the way you are, but it makes it harder for the onlooker to tell what you mean.

My convention is:
classes/structs: ALLCAPS
funtions: MyFunction() //the first letter of an actual word is cap'd and of course no spaces
variables: gMyVariable //similar to the functions, but the first letter tells what type of variable it is "g" global, "i" integer, "f" float,.....etc

Do it however you like, but it's easier for others if you make some kind of logical distinctions.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 24th Jan 2012 21:57
that would be much neater for me to distinguish so i will try and adopt that from here on out.

hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 24th Jan 2012 21:58
but from what i've given you, you can't really see why db functions should just not do anything.

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jan 2012 22:18
It's not that I can't see the db funtions, it's that I can't tell where you are making the projectile. I assume you will have more than one projectile on the screen at a time, and from what I see there is only one. You need an array or some kind of linked list to generate more than one of ANYTHING.

The fastest code is the code never written.
hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 25th Jan 2012 00:44
yeah im using a vector to do that.

but regardless of that if i create one or 1000 dbsprite should create a sprite

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jan 2012 02:54
What vector?
A vector is a direction with magnitude. You need something to possess the vector. Show me the entire class that will contain the projectile.....

Here is an example of what I would do for something like bullets:

That is about as simple as I can make it. You have an initializer, but it does nothing.

The fastest code is the code never written.
Dar13
11
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 25th Jan 2012 02:59
Quote: "What vector?"

He's talking about a std::vector, Hawkblood. The STL resizable array. Not a mathematical vector.

Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jan 2012 03:08 Edited at: 25th Jan 2012 03:10
That would not be good for bullets because that resizable array needs to be contiguous and bullets are not allways destroyed in sequence. I've never used it before, so perhapse I'm wrong.

Now that I understand how you are creating them, I think we can continue. Here is a problem I have found:

You are "moving" the sprite and repositioning it but never are you changing the x,y value. This will cause your projectile to stay in one spot. Where are you putting the initial position?

EDIT:
Also, your projectile class doesn't have inheritance from "vector".

The fastest code is the code never written.
Dar13
11
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 25th Jan 2012 04:00 Edited at: 25th Jan 2012 12:34
Hawkblood, this is how I use the std::vector for bullets.



Perhaps he's not trying to do anything like this at all, but this works just fine for me.

EDIT: hookkshot, we need all the code you have for your projectiles. Like when is projectile:raw() called? When is projectile::Update() called? I can't understand your system of updating and drawing the projectiles based on the code you've given us.

hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 25th Jan 2012 07:35
im out at the moment will get all projectile code up later and hopefully my problem will be solved

hookkshot
12
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 26th Jan 2012 17:54
well im still not sure what the problem was so i remade the file coding it again the same way and all my db functions work now.

My friend thinks something was interrupting the library but ill never be sure

Login to post a reply

Server time is: 2019-12-13 22:08:15
Your offset time is: 2019-12-13 22:08:15