I Have No Idea Whats Wrong...

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

I Have No Idea Whats Wrong...

Post by davidthefat »

I know its with the arguments, but I have no Idea how to fix it...

I uploaded it since I dont want to copy paste....


fixed something

Code: Select all

void GameSetUp::SetCoor(int X, int Y, int TempX, int TempY)
{
     x = X;
     y = Y;
     tempX = TempX;
     tempY = TempY;
}

Still the map is still messed up
Attachments
Game.zip
Its the Source Codes
(2.2 KiB) Downloaded 75 times
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: I Have No Idea Whats Wrong...

Post by davidthefat »

New File, fixes the moving but not the map, need help on map ;)
Attachments
Game.zip
The new one
(2.27 KiB) Downloaded 83 times
User avatar
Kros
Chaos Rift Regular
Chaos Rift Regular
Posts: 136
Joined: Tue Feb 24, 2009 4:01 pm
Current Project: N/A
Favorite Gaming Platforms: PC, Playstation/2/3
Programming Language of Choice: C++
Location: Oregon,USA
Contact:

Re: I Have No Idea Whats Wrong...

Post by Kros »

Could you specifically outline the code thats "broken" and what your specific problem is? Most of us really dislike having to download source, get the libraries, compile/build, then figure out whats wrong (can vary depending on what your view of 'wrong' is).

Also, for future reference: http://www.pastebin.com is a fantastic site for collaborative debugging.

Thanks.
Isaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
YouTube Channel
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: I Have No Idea Whats Wrong...

Post by programmerinprogress »

One way you might consider when writing argument names which are almost identical to some members in your class, is using the this keyword and the arrow operator (->) to make things clearer (it also means you don't have to worry about running out of relevant keywords)

for example, you would implement your first chunk of code like this:

Code: Select all

void GameSetUp::SetCoor(int x, int y, int Tempx, int Tempy)
{
     this->x = x;
     this->y = y;
     this->tempx = Tempy;
     this->tempx = Tempy;
}
PS: I didn't look at the rest of your code, I really don't have the time at the moment, but I hope you solve the problem in a stress-free and timely manner.

Maybe you should explain exactly what's wrong, if you need anymore help.
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: I Have No Idea Whats Wrong...

Post by davidthefat »

I think the problem is with the loading of the map arrays or the actual drawing of it...
User avatar
resatti
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 11
Joined: Thu Oct 02, 2008 5:14 pm
Location: N/A
Contact:

Re: I Have No Idea Whats Wrong...

Post by resatti »

make sure that all the variables are DECLARED
Click here to see the hidden message (It might contain spoilers)
PART 1
R: What do you want for breakfast, L?

L: Well, let's see. I want tacos, waffles, and snickerdoodle.

A: Snickerdoodle?

R: Tacos and waffles don't go together, L.

L: I know that, R. A, snickerdoodle is a German cookie.

A: Well, whay didn't you say so, L? My butt just got equiped with a cookie gun!

R and L: Gun?

R: Run, L, A is gonna shoot us with his...

...whatever it is called!!!! Come on, L!

(L gets hit in the back of the head with a cookie and becomes unconsis.)

R: L!?

(Cookies fly everywhere, but R manages to escape)

A: It's going out of control!!!!! I can't stop it! Ohh......

(A explodes with a loud and thunderous BAM POP SLASH!)

The house (which belongs to L) no longer existed. A blew up and left R wondering what happened to A and L. R checked out the scene and saw no trace of A or L. There were many questions to be asked: Where is L and A? Is L and A alive? How did A get a cookie gun in his a**? No one knew the answer.

Countinued...
Spoiler'd. --Mar
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: I Have No Idea Whats Wrong...

Post by davidthefat »

resatti wrote:make sure that all the variables are DECLARED
Obviously they are :roll:
Scoody
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 65
Joined: Fri Feb 06, 2009 2:07 pm

Re: I Have No Idea Whats Wrong...

Post by Scoody »

You can't copy an array like this:

Code: Select all

     
  map[24][32] = m[24][32];
  objMap[24][32] = o[24][32];
Arrays start at 0, so what you're doing here is assigning the value that happens to reside somewhere outside the array m to the array map; or actually you're not assigning it to the map array, it's outside that one too.

You should read more on arrays and understanding them, it will make this task much easier.
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: I Have No Idea Whats Wrong...

Post by programmerinprogress »

Scoody wrote:You can't copy an array like this:

Code: Select all

     
  map[24][32] = m[24][32];
  objMap[24][32] = o[24][32];
Arrays start at 0, so what you're doing here is assigning the value that happens to reside somewhere outside the array m to the array map; or actually you're not assigning it to the map array, it's outside that one too.

You should read more on arrays and understanding them, it will make this task much easier.
also, you can't just assign an array to an array in c++ AFAIK, you initialise an array by either including braces and the list of values you wish to initialise the array with, or you could use some iteration to assign those values to the correct corresponding arrays, for example, for a 2 dimensional array, some nested for loops will usually suffice.

Code: Select all

for(int i = 0; i < 24; i++)
{
   for(int j = 0; j < 32; j++)
   {
         map[i][j]  = m[i][j]
   } 
}

// just as a side note, I would recommend using constants instead of 24 and 32 
// you'll end up having inconsitent numbers which could lead to bugs if you 
// don't have identifiers that you only have to change once
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: I Have No Idea Whats Wrong...

Post by short »

Code: Select all

void GameSetUp::SetCoor(int x, int y, int Tempx, int Tempy)
{
     this->x = x;
     this->y = y;
     this->tempx = Tempy;
     this->tempx = Tempy;
}
If this function is inside a class that you are instantiating then it should work.

edit: are you instantiating a new GameSetUp object? If you are, then the above should be your solution.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
Post Reply