Search found 708 matches

by hurstshifter
Sat Jun 13, 2009 10:34 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: [Solved] Calling a class function from another class

Out of curiosity, did you end up changing your original design? Or did you stick with passing a player object? I went with the array of bullet objects within the player class. Definitely a better way to go with a simple game such as this. I then created a shoot() function in player that is passed a...
by hurstshifter
Sat Jun 13, 2009 10:16 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

And lo, on the 6th hour of coding there was triumph. Bullets flew over yonder with much speed and accuracy. And there was much rejoicing, yayyy.
by hurstshifter
Sat Jun 13, 2009 9:26 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

I was think this too. I'd try letting the player class hold an array of bullet objects. Then create a fireBullet function for the player. Just grab the first bullet in the array that's currently bDead and shift its properties around. You'll have access to private player variables and then adjust th...
by hurstshifter
Sat Jun 13, 2009 8:51 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

Why are we passing a player object to a bullet? That doesn't seem right to me... :| We are doing this so the bullet knows where to draw itself. We get the x and y offsets of the player and draw the bullet directly above it. I'll try separating the classes into different source files. Not sure if th...
by hurstshifter
Sat Jun 13, 2009 8:00 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

As t23 said, make sure the Player class is capatilized. Also, if you have seperate source files, make sure you're including player.h in the bullet header file. They are capitalized. I have a class.h and class.cpp file for my classes. Maybe thats where my problem is. Should I be seperating each clas...
by hurstshifter
Sat Jun 13, 2009 7:23 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

Its been a while since I've done C++, but are your class names matching in case? It seems like you went from camel case to all lowercase. Player != player in C++ Sorry, I manually typed some of the code in which is why it was capitalized. As a rule, I always begin functions and variables with lower...
by hurstshifter
Sat Jun 13, 2009 7:02 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

public: Bullets(); void createbullets(Player &player); void updatebullets(); void checkbullets(); void killbullets(); You need that parameter in your prototype. I have it there. I had pasted in the code before I edited it. Despite how this looks like it should work, I'm still getting some error...
by hurstshifter
Sat Jun 13, 2009 6:37 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

Dudes... void bullets::createbullets(Player &player) { SDL_Rect pTemp = player.getprect(); bulletRect.x = pTemp.x; bulletRect.y = (pTemp.y - 10); bDead = 1; bVel = 1; } That will do what you want it to do, provided that Player::getprect() is a public function. edit: I will elaborate. When you c...
by hurstshifter
Sat Jun 13, 2009 6:13 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

Re: Calling a class function from another class

In the bullet::createbullets() function could you not just get the x, y of the player as you normally would? For example, since you must have created an instance of the player somewhere, for the bullets x, y could you not just say something like: x = PlayerInstance.get_x(); y = PlayerInstance.get_y...
by hurstshifter
Sat Jun 13, 2009 4:48 pm
Forum: Programming Discussion
Topic: [Solved] Calling a class function from another class
Replies: 21
Views: 1466

[Solved] Calling a class function from another class

Hey Everyone, So basically I'm trying to call a function from one class in a function from another class. Here's a snippet of the code. I have never done this before and am realizing quickly that it isn't as simple as it sounds. void bullets::createbullets() { SDL_Rect pTemp = player::getprect(); bu...
by hurstshifter
Sat Jun 13, 2009 12:56 pm
Forum: Reviews
Topic: Final Fantasy Tactics Advance
Replies: 11
Views: 10336

Re: Final Fantasy Tactics Advance

This game is awesome!!! story- so far I'm enjoying the story, I'm about 15 and a half hours in and I've heard the game is about 300 hours long and that doesn't surprise me. The story starts when a child who loves final fantasy finds a book that puts the user in whatever world they want to go into. ...
by hurstshifter
Sat Jun 13, 2009 12:09 am
Forum: General Gaming
Topic: Is the PS2 Dead?
Replies: 23
Views: 4471

Re: Is the PS2 Dead?

I own both versions. I beat it for PS2 before I even owned my first Dreamcast. When I got it and my Dreamcast, I was like OMFG WTF!?!? ITS BETTER ON DREAMCAST!?!? Agreed. That was actually one of the first games I had for Dreamcast. Let it be known that the AIGD series has inspired me to bring my D...
by hurstshifter
Fri Jun 12, 2009 12:18 pm
Forum: Current Events and Science/Technology
Topic: Project Nay-Tal
Replies: 27
Views: 4928

Re: Human-AI interaction; Project NATAL

thejahooli wrote: Also Molyneux has a habit of over hying things.

Biggest understatement in the history of The Chaos Rift.
by hurstshifter
Fri Jun 12, 2009 12:09 pm
Forum: Programming Discussion
Topic: Help with Vectors
Replies: 5
Views: 483

Re: Help with Vectors

I was given this link on IRC about vector and matrix math, i'm slowly working my way through it, you might want to check it out! http://chortle.ccsu.edu/VectorLessons/index.html I find a lot of the time it makes absolutely no sense to begin with, but if you follow the questions along the top and bo...
by hurstshifter
Fri Jun 12, 2009 9:49 am
Forum: General Gaming
Topic: Is the PS2 Dead?
Replies: 23
Views: 4471

Re: Is the PS2 Dead?

okay. I have 200 somethin bucks(I'm 13), so it's not gonna be a big chunk out of my wallet. Unlike the Xbox 360, where each game would make me need to babysit for... 8 hours. With 200 bucks you could buy a ps2 and a bunch of good games. Buy them used, just make sure you check the discs so they are ...