Re: anyone wanna make an UGH! remake?
Posted: Fri Dec 05, 2008 5:30 pm
if you work hard, and do as i advice, i promise we will at least have a version that you can fly around in. with collisions.
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
Great, what's up next?avansc wrote:if you work hard, and do as i advice, i promise we will at least have a version that you can fly around in. with collisions.
Can you explain how this functions is going to be like?avansc wrote: add_object(int x, int y, int w, int h);
i just mean that you should putPixelP wrote:How is these functions going to work out?avansc wrote:okay, those will work nice. no add some member functions to the level class.
we will need.
add_object(int x, int y, int w, int h);
move_object(&objectclass, int x, int y);
change_object(&objecclass, int w, int h);
PixelP wrote:I've made the two classes:Code: Select all
//object.h #pragma once class ObjectClass { public: int x, y; int w, h; };
Code: Select all
//level.h #pragma once class LevelClass { public: ObjectClass levelData[10]; int ObjectCount; };
Code: Select all
new_Object(int x, int y, int w, int h)
{
this->ObjectCount++;
if(this->ObjectCount >9)
return
this->Object[this->ObjectCount].x = x;
this->Object[this->ObjectCount].y = y;
this->Object[this->ObjectCount].w = w;
this->Object[this->ObjectCount].h = h;
}
Code: Select all
//level.h
#pragma once
class LevelClass {
public:
ObjectClass levelData[10];
void add_object(int x, int y, int w, int h);
void move_object(ObjectClass* obj, int x, int y);
void change_object(ObjectClass* obj, int w, int h);
};
void LevelClass::add_object(int x, int y, int w, int h) {
//????????????
}
void LevelClass::move_object(ObjectClass* obj, int x, int y) {
obj->x = x;
obj->y = y;
}
void LevelClass::change_object(ObjectClass* obj, int w, int h) {
obj->w = w;
obj->h = h;
}
Code: Select all
void LevelClass::add_object(int x, int y, int w, int h) {
this->objectCount++;
if(this->objectCount > 9) {
return;
}
this->levelData[this->objectCount].x = x;
this->levelData[this->objectCount].y = y;
this->levelData[this->objectCount].w = w;
this->levelData[this->objectCount].h = h;
}
Code: Select all
//debug.h
#pragma once
class DebugClass {
private:
std::fstream debugFile;
public:
DebugClass();
void DebugLine(std::string str);
};
DebugClass::DebugClass() {
debugFile.open("debug.txt", std::fstream::out);
}
void DebugClass::DebugLine(std::string str) {
debugFile << str << std::endl;
debugFile.flush();
}