I'm not exactly sure what you mean by "loads of global variables", but if you mean you want global variables that any class/.cpp file can access, maybe a static class containing the required properties would be possible?
I've heard of that as a good solution for global variables in OOP-based AS3 projects, and I'm thinking of using it whenever I need them.
currency:
1 chip's worth: wood
3: rock
5: stone
10: steel
25: iron
50: bronze
100: silver
250: gold
500: diamond
you start defeating low-level enemies by poking them with a sword handle. every time you kill one, you get a wood chip. 10 of these can be used to make a sword upgrade, and make a wooden sword. OR, you can use these to buy potions at shops.
EDIT: whoops, put it in the wrong section. can you move it, moderator?
As you can see, I've been trimming the fat. The filesize is noticeably smaller (2,210kb turned to 491kb). This is mainly from eliminating libraries that aren't even required yet (like sound, fonts, png). I think I've decided on a final format for maps as well, so feel free to fool around with the test one (data/maps/test.xml). Please understand that the engine will crash if you change the depth of image elements and then reloading.
Controls: Press 0 to initialize the xml-parser (forgot to automate ). Press F5 to Load/Reload "data/maps/test.xml".
Please post questions here. I'm still working on other elements, but this was an improvement to the previous one due to defining rectangles to draw from images inside the map file itself (view "data/maps/test.xml" to see).
It's a good idea to compile for debug when you're working on a game, since you can use gdb and such to search for problems (I think you can use gdb out of Code::Blocks, I never toyed with it), since it adds a bunch of debug symbols to the executable. These debug symbols take a very large amount of disk space, so if you want, you can compile for release (Build menu->Select target->Release) and that'll cut down on the file size of the executable a lot. Just be sure to set it back to Debug once you're done, since I think it compiles faster then, too.
i like messing with the images, putting my name on it.
once, on the other build, i told someone it was a game, and they watched the blue "loading sign" for about 5 minutes!
HAHA! I'm glad I got to make someone feel stupid. ;P
I'll go work on it now.
@MOM Yeah, I know about setting it to Release. I hope you don't think I'm dumb or something, because that's what it seems like. The change in size is like half a megabyte in the actual size (not the zip) so I guess I didn't know that it would be that much of a difference.
New Build. It's the same link as before. Just some minor changes. But now it has a changelog and the ability to load maps from the command-line. Check out the changelog for more info on changes. Now has a build number.
I thought it was pretty straightforward: "I think I've decided on a final format for maps as well, so feel free to fool around with the test one (data/maps/test.xml)."
I thought it was pretty straightforward: "I think I've decided on a final format for maps as well, so feel free to fool around with the test one (data/maps/test.xml)."
What I mean is later on, when there is more stuff. Right now, it isn't that complicated, unless you're a spam bot.
Oh, other stuff? I'm really unsure on what kind of thing I should add right now. Until we have basic global rules, (velocity-changers like gravity and blow-back) I can't really come up with any entities or similar things. I really need a player sprite-sheet to work with. Once I have a player walking around, I'll be able to create things for the player to interact with.
-'base.xml' created and started
-Background image for base created
-Updated WM title
-Re-added support for PNG images
-Added basic cursor image; change by editing 'data/hard/curs.png'
-Trimmed the fat some more
Basic global rules should be set in the level XML, like in World of Goo (gravity is just another directional force).
For basic physics, each simulated object should have four properties, depending how you implement it: vX, vY, x, and y; or theta, v, x, and y. For a platform game we should probably use the first one.
Then, in the game, just add something like this pseudocode:
if(this->touching(linearforce)){
this->vX += linearforce.dX;
this->vY += linearforce.dY;
}
if(this->touching(ground)){
this->vY *=-ground.bouncefactor;
this->vX *= ground.friction;//Between 0 (can't slide) and 1 (frictionless)
}
if(this->vX<1)
this->vX =0;
if(this->vY<1)
this->vY =0;
if(this->vY > terminal_velocity){
this->vY = terminal_velocity;
console <<"Terminal Velocity!"<< endl;
}
if(this->vY <-terminal_velocity){
this->vY =-terminal_velocity;
console <<"Negative Terminal Velocity!"<< endl;
}
...
this->x += this->vX;
this->y += this->vY;
and map it to the screen at (x,y). Ta-da! Simple physics simulation!
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
Ok, cool. Sorry for taking so long.
Btw, when you #define THIS_HEADER_H, you don't have to define it as 1 or anything. It's standard to just define it with no value.
IRC | Chapter Tutorial | Reference Guide
I'm not exactly sure what you mean by "loads of global variables", but if you mean you want global variables that any class/.cpp file can access, maybe a static class containing the required properties would be possible?
I've heard of that as a good solution for global variables in OOP-based AS3 projects, and I'm thinking of using it whenever I need them.
New GooFans Rules | My Addins
Just upgraded to the newest version of GCC and now my old code is so full of errors I might just rewrite it. What changed so much?
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
Hmm. Is it the new C++ 11 standard?
IRC | Chapter Tutorial | Reference Guide
AP told me to define it as 1. It's obvious he's still doing old-style C++ which is probably why his code is full of errors.
I tweet like a bird
I have a lame website
How do you mean? You've been able to define macros with no value for quite a long time.
IRC | Chapter Tutorial | Reference Guide
HE IS GETTING ERRORS. HOW WOULD I KNOW.
I tweet like a bird
I have a lame website
I just used 1 because I wasn't sure what to define it as. Valueless macros aren't covered in my textbook.
The error are things like: I need to declare private class members before public functions that use them. You didn't need to before.
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
currency:
1 chip's worth: wood
3: rock
5: stone
10: steel
25: iron
50: bronze
100: silver
250: gold
500: diamond
you start defeating low-level enemies by poking them with a sword handle. every time you kill one, you get a wood chip. 10 of these can be used to make a sword upgrade, and make a wooden sword. OR, you can use these to buy potions at shops.
EDIT: whoops, put it in the wrong section. can you move it, moderator?
-_-
its a game discussion. Put anything game related here, but try to put them in specific areas
Thus his edit.
I tweet like a bird
I have a lame website
Current Build. No code this time. Just the binary.
As you can see, I've been trimming the fat. The filesize is noticeably smaller (2,210kb turned to 491kb). This is mainly from eliminating libraries that aren't even required yet (like sound, fonts, png). I think I've decided on a final format for maps as well, so feel free to fool around with the test one (data/maps/test.xml). Please understand that the engine will crash if you change the depth of image elements and then reloading.
Controls: Press 0 to initialize the xml-parser (forgot to automate ). Press F5 to Load/Reload "data/maps/test.xml".
Please post questions here. I'm still working on other elements, but this was an improvement to the previous one due to defining rectangles to draw from images inside the map file itself (view "data/maps/test.xml" to see).
I tweet like a bird
I have a lame website
MOM, what does it say about its file size?
ITS OVER 2 THOUSAND!!!
WHAT 2 THOUSAND?!?!
Let me see what the download window says about its file size now...
It's under FIVE HUINDRED!
Five hundred? That's nowhere NEAR nine thousand!
Oh. My bad.
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
It's a good idea to compile for debug when you're working on a game, since you can use gdb and such to search for problems (I think you can use gdb out of Code::Blocks, I never toyed with it), since it adds a bunch of debug symbols to the executable. These debug symbols take a very large amount of disk space, so if you want, you can compile for release (Build menu->Select target->Release) and that'll cut down on the file size of the executable a lot. Just be sure to set it back to Debug once you're done, since I think it compiles faster then, too.
IRC | Chapter Tutorial | Reference Guide
Hurr
I tweet like a bird
I have a lame website
i like messing with the images, putting my name on it.
once, on the other build, i told someone it was a game, and they watched the blue "loading sign" for about 5 minutes!
-_-
HAHA! I'm glad I got to make someone feel stupid. ;P
I'll go work on it now.
@MOM Yeah, I know about setting it to Release. I hope you don't think I'm dumb or something, because that's what it seems like. The change in size is like half a megabyte in the actual size (not the zip) so I guess I didn't know that it would be that much of a difference.
I tweet like a bird
I have a lame website
New Build. It's the same link as before. Just some minor changes. But now it has a changelog and the ability to load maps from the command-line. Check out the changelog for more info on changes. Now has a build number.
I tweet like a bird
I have a lame website
downloaded it.
suggestion: maybe the next build should have insrtuctions on how to do cool stuff with it, how to use it, etc.
-_-
I thought it was pretty straightforward: "I think I've decided on a final format for maps as well, so feel free to fool around with the test one (data/maps/test.xml)."
I tweet like a bird
I have a lame website
sweet
How close are you to a sprite sheet?
I tweet like a bird
I have a lame website
Naw, not assuming you were dumb or anything, and I think I already said that someplace before, so sorry bout dat.
IRC | Chapter Tutorial | Reference Guide
Better be.
I tweet like a bird
I have a lame website
What I mean is later on, when there is more stuff. Right now, it isn't that complicated, unless you're a spam bot.
-_-
Oh, other stuff? I'm really unsure on what kind of thing I should add right now. Until we have basic global rules, (velocity-changers like gravity and blow-back) I can't really come up with any entities or similar things. I really need a player sprite-sheet to work with. Once I have a player walking around, I'll be able to create things for the player to interact with.
What do you mean by me being a spam bot?
I tweet like a bird
I have a lame website
Build 0003
-Background image for base created
-Updated WM title
-Re-added support for PNG images
-Added basic cursor image; change by editing 'data/hard/curs.png'
-Trimmed the fat some more
I tweet like a bird
I have a lame website
Basic global rules should be set in the level XML, like in World of Goo (gravity is just another directional force).
For basic physics, each simulated object should have four properties, depending how you implement it: vX, vY, x, and y; or theta, v, x, and y. For a platform game we should probably use the first one.
Then, in the game, just add something like this pseudocode:
and map it to the screen at (x,y). Ta-da! Simple physics simulation!
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
Of course, you could also use theta and v, then map them to vX and vY:
That would work better for projectiles.
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.