I have decided to make both things in C++ now because i'm learning more about it and need some project to start with.
*'ed are changed things
I am making a map/level editor in *C++, for a arcade style top down shooter,(also in *C++) i need to know how to do basic things like...
1. File creating/writing/loading
I need to know how to create new documents, using *C++, and write them so that i can make map files for my game.
2. Cursor and tile clipping to a grid
I need to know how to... Lets say i have a red square as my cursor, i want to make this cursor automatically clip to a grid so
so that when i run functions and such, to lay a(n) tile/item/unit and it will be correctly placed
*
*
As you can see, i am still aiming for the same things, and still need help with the same things.
Once again,
Much appreciated,
MadPumpkin
Map editor help please! :} (changed my mind)
Moderator: Coders of Rage
- MadPumpkin
- Chaos Rift Maniac
- Posts: 484
- Joined: Fri Feb 13, 2009 4:48 pm
- Current Project: Octopia
- Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
- Programming Language of Choice: C/++,Java,Py,LUA,XML
- Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk
Map editor help please! :} (changed my mind)
Last edited by MadPumpkin on Sun Feb 15, 2009 6:10 pm, edited 1 time in total.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Map editor help please! :}
Not familiar enough with BlitzBasic personally to be able to help you with file/io but I'll tackle the easy problem: clip to grid in C++ (you surely have equivalent in BB) can be done by:MadPumpkin wrote:I am making a map/level editor in BlitzBasic, for a arcade style top down shooter,(also in BB) i need to know how to do basic things like...
2. Cursor and tile clipping to a grid
I need to know how to... Lets say i have a red square as my cursor, i want to make this cursor automatically clip to a grid so
so that when i run functions and such, to lay a(n) tile/item/unit and it will be correctly placed
Code: Select all
float cursorX = mouse cursor's x position
float cursorY = mouse cursor's y position
cursorX = floor(cursorX); //1.2131 becomes 1, 1.9999 becomes 1, 1 becomes 1
cursorY = floor(cursorY);
Code: Select all
cursorX = int(cursorX);
cursorY = int(cursorY);
Code: Select all
cursorX OR cursorY = ceil(cursorX); //1.2131 becomes 2, 1.99999 becomes 2, 1.000000000001 becomes 2, 1 becomes 1
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- MadPumpkin
- Chaos Rift Maniac
- Posts: 484
- Joined: Fri Feb 13, 2009 4:48 pm
- Current Project: Octopia
- Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
- Programming Language of Choice: C/++,Java,Py,LUA,XML
- Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk
Re: Map editor help please! :}
Thank you very much! ill get started on that part of the code right away :}
thanks again
thanks again
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- MadPumpkin
- Chaos Rift Maniac
- Posts: 484
- Joined: Fri Feb 13, 2009 4:48 pm
- Current Project: Octopia
- Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
- Programming Language of Choice: C/++,Java,Py,LUA,XML
- Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk
Re: Map editor help please! :} (changed my mind)
Hey People!! i am in dire need of help! seriously im bad at level editor creation!!!
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Map editor help please! :} (changed my mind)
Okay, file I/O in C++ goes like this:
Wrote that here in phpBB but I think it'll work as-is
Code: Select all
#include <fstream> //file operation thingies
#include <string> //for C++ style strings
#include <iostream> //for cout, cin
using namespace std;
int main() {
string fname;
string pants;
cout << "Gimme filename: ";
getline(cin, fname);
ifstream myfile(fname.c_str()); //ifstream as in iutput filestream as in file acts as input as in read from file
while (myfile) { //while myfile is open and accessible and isn't out of data to throw at us
getline(myfile, pants); //pull a line from myfile
cout << pants << endl; //write it to screen
}
myfile.close();
string input;
cout << "Gimme anudder filename: ";
getline(cin, fname); //overwrite fname with console input
ofstream myfile2(fname.c_str()); //ofstream as in output filestream as in output to file
//by default, if file doesn't exist, it is created
cout << "Tell me something!";
//do a priming read
getline(cin, input); //get some user input
while (input != "") { //as long as the user doesn't input nothing, keep doing this stuff
myfile2 << input << endl; //write input to file
getline(cin, input); //get some more user input
}
myfile2.close();
return 0;
}
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Re: Map editor help please! :} (changed my mind)
Yeah it took me a day or two to get down file I/O but once you understand it and get it right it becomes fairly simple
- MadPumpkin
- Chaos Rift Maniac
- Posts: 484
- Joined: Fri Feb 13, 2009 4:48 pm
- Current Project: Octopia
- Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
- Programming Language of Choice: C/++,Java,Py,LUA,XML
- Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk
Re: Map editor help please! :} (changed my mind)
well i understand file I/O now lol but yea your righteatcomics wrote:Yeah it took me a day or two to get down file I/O but once you understand it and get it right it becomes fairly simple
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock