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 / Variables getting the same value

Author
Message
R4z0r1991
15
Years of Service
User Offline
Joined: 30th Jan 2009
Location:
Posted: 1st Jun 2009 10:52
I've got a task to create ludo in my programing class and because we was forced to only use c++, I decided to use DarkGDK (have used dbp for 1 year now).

Now my problem is that my game doesn't work and I have found out that it's (probably) because of that some of my variables is getting the same value (Never had this problem with dbp )



Any help would be great

(Have included the game, both the working made in dbp and the non working in c++)

Attachments

Login to view attachments
Grandma
18
Years of Service
User Offline
Joined: 26th Dec 2005
Location: Norway, Guiding the New World Order
Posted: 1st Jun 2009 12:04
I didn't look trough the code much, but when using arrays in C++. You should declare them with 1 more 'element' then what you are planning to use.

int victory[4]; -> int victory[5];
That may be the reason for your problem. I Got the same problem when I switched to GDK.

This message was brought to you by Grandma industries.

Making yesterdays games, today!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st Jun 2009 13:50
Quote: "You should declare them with 1 more 'element' then what you are planning to use."

I think I know what you mean but what you said might be interpreted wrongly.

If you declare an array with 5 elements, then you should be planning to use 5 elements. Arrays in C++ are 0 indexed so if the array has a total of 5 elements then the first element is 0 and the last element is 4. This means that an array of 5 elements has elements 0, 1, 2, 3, 4.

The following code demonstrates this:


R4z0r1991
15
Years of Service
User Offline
Joined: 30th Jan 2009
Location:
Posted: 1st Jun 2009 16:30
Thanks both of you, I should have seen this myself

It's still not working right, but it's probably just some "if" that is wrong which I can fix myself, thanks again

Login to post a reply

Server time is: 2024-11-25 10:33:35
Your offset time is: 2024-11-25 10:33:35