Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

124 Neutral

About Joshnathan

  • Rank
  1. Hello everyone, I just wanted to ask if anyone knows of a good site where I can learn how to program games in javascript/PHP. I know the basics of both languages, but have only used them for basic webdesign. I want to offer my visitors some more :D. Hope someone has the answer, Joshua
  2. Joshnathan

    keyboard input in the console

    uh, it has been a while since I have done it, but had a nice tutorial on it (now it is paying though...). You should use something like "ReadConsoleInput()", although I don't know which parameters it takes anymore. Do a google search on that and you should be able to find the answer quickly :D Hope that helps, Joshua
  3. Joshnathan

    Problems installing SDL_Image and Sfont

    if you are using Dev-C++, the sdl headers get installed in a different way like: <SDL/SDL.h> or <SDL/SDL_image.h> Maybe that is the problem, Joshua
  4. Quote:well, as ASP is a client side "semi-programming" language already, you could even do it completely in ASP (although it could be kinda though :D). But as far as I know, you can always start your exe from your site. I even had a little game installed on my old site which was created in c++. Just put it somewhere and use some plain HTML like: a href="game.exe"*something /a (can't put the bracets or the forum takes it as a link. Quote: Just thought I'd point out that 1) it is SERVER SIDE not client side (ie it runs on your web server) 2) ASP is not a programming language itself (for example you can use ASP using VBScript, JScript etc as the language and ASP.NET supports 20+ different languages - including c# which I wouldn't consider a "semi-programming language" [wink] ) 3) you couldn't write a multiplayer web-based game using just ASP (unless it was very basic - ie form based) - for the above reasons (ie you need some client side code) sorry, my mistake. Not that I didn't know it, just an error of inattention. For the rest, it is weird. I try'd the same thing (playing a .exe from my site, but I guess it worked because I checked it on my own computer... As for the fact that you can use asp tu program a whole game (basic but still online) I stick with that. I am sure, if you get a little bit into javascript you can get quite far using asp to handle "server-side" (not mistaken now :D) functions. I hope this will help you, Joshua
  5. Joshnathan

    SDL problem (big one)

    I have a weird problem, I had my application up and running, changed a few things, saw it didn't work, changed back and saw it still didn't work... I really don't see where the error should be. The application compiles fine, but won't display the map anymore, the has to be something wrong with this file: #include <SDL/SDL_image.h> #include <SDL/SDL.h> #include <fstream> #include <cstring> #include <sstream> #include "world.h" #include "gamedata.h" #include "log.h" using namespace std; #define WORLD_W 40 #define WORLD_H 30 WORLD world[40][30]; bool InitWorld() { SDL_Surface *grass = IMG_Load("map.gif"); SDL_Surface *water = IMG_Load("water.gif"); SDL_Surface *tree1 = IMG_Load("tree1.gif"); SDL_Surface *tree2 = IMG_Load("tree2.gif"); SDL_Surface *warp = IMG_Load("warp.gif"); ifstream file_in(gamedata.Map_Name.c_str()); if(!file_in) return false; int x = 0; int y = 0; char tile; while(y != WORLD_H) { file_in >> tile; switch(tile) { case '0': world[x][y].image = grass; world[x][y].value = 0; break; case '1': world[x][y].image = water; world[x][y].value = 1; break; case '2': world[x][y].image = tree1; world[x][y].value = 1; break; case '3': world[x][y].image = tree2; world[x][y].value = 1; break; case '4': world[x][y].image = warp; world[x][y].value = 0; gamedata.wX = x * 20; gamedata.wY = y * 20; break; default: file_in.close(); return false; break; } world[x][y].x = x*20; world[x][y].y = y*20; x++; if(x == WORLD_W) { x = 0; y++; } } file_in.close(); logfile.Write("Loaded " + gamedata.Map_Name + " into the system"); return true; } void DisplayWorld() { for(int j = 0; j < WORLD_H; j++) { for(int i = 0; i < WORLD_W; i++) { SDL_Rect rect; rect.x = world[j].x; rect.y = world[j].y; SDL_BlitSurface(world[j].image, NULL, gamedata.screen, &rect); } } logfile.Write("Displayed " + gamedata.Map_Name + " onto the screen"); } string ToString(int number) { stringstream temp; temp << number; return temp.str(); } void ChangeWorld(int x) { string number = ToString(x); string world = "worlds/world" + number; gamedata.Map_Name = world + ".txt"; logfile.Write("--------------------------------"); logfile.Write("Changed worlds to: " + gamedata.Map_Name); logfile.Write("--------------------------------"); InitWorld(); DisplayWorld(); } I think the error should be somewhere in the DisplayWorld() or InitWorld(), but I really can't find it. Maybe it is one of those stupid errors that you just don't see anymore after you have looked over it 100s of times. If the error is not here, I have made the full source code available here. Please give me some pointers as to how I could possibly fixe my problem, Joshua
  6. well, as ASP is a client side "semi-programming" language already, you could even do it completely in ASP (although it could be kinda though :D). But as far as I know, you can always start your exe from your site. I even had a little game installed on my old site which was created in c++. Just put it somewhere and use some plain HTML like: a href="game.exe"*something /a (can't put the bracets or the forum takes it as a link. Hope this helps, Joshua
  7. Joshnathan

    Write to error log

    This is my class: #ifndef LOG_H #define LOG_H #include <iostream> #include <fstream> #include <cstring> using namespace std; class LOG { public: void CreateLog(); void Write(string); void CloseLog(); private: ofstream log_file; }; extern LOG logfile; #endif This is log.cpp: #include <iostream> #include <cstring> #include "log.h" using namespace std; LOG logfile; void LOG::CreateLog() {"log.txt", ios_base::out | ios_base::app); if(!log_file) cout<< "Error Creating log file"; } void LOG::Write(string logtext) { log_file << logtext << endl; } void LOG::CloseLog() { log_file.close(); } It works fine, tell me if there is a disadvantage to using a log in this way. Joshua
  8. Joshnathan

    Need Good Win32 api tutorial

    I would certainly go for
  9. Joshnathan

    Write to error log

    I created a class LOG (functions CreateLog(),Write(), CloseLog()) , with an extern instance, like this I can get errors in my whole project. The only Problem I have is that is doesn't want to write to the file yet. I don't have the code with me, will post it this evening (GMT), but the idea is ok no? Or am I mistaken? Joshua
  10. Joshnathan

    Write to error log

    Hi all, I just want to know how I can write to "stderr" logfile to help debug my game. Thanks, Joshua P.S. I mean a standard function, not an "open, write, close" file system.
  11. Joshnathan

    RPG event handling

    I was thinking of a much more simple method. I want to implement a simple BattleMode() function... Like: //Poll For keyboard events //if a monster hits the player --> BattleMode() //as soon as BattleMode() ends, I come back in the same loop, so my map gets redrawn automaticly... Tell me if you don't agree :D (I know I get a response when I ask that lol), Joshua
  12. Joshnathan

    Icon for .exe

    Hi all, I just wanted to ask how I can change the icon for my .exe game file. I don't really like the window, and I know you should be able to change it, but how? I don't need what information you need, so I just give everything: I program in c++ using SDL and Dev-C++. Thanks, Josua
  13. Joshnathan

    RPG event handling

    nice ideas all of you! :D my idea atm is to make a different event header for each world. and put a check for events in a keyboard input loop. Normally this should work, but I guess I will only see once I try :D If I have any problems I will post them here, and maybe even some screens if my friends do some nice artwork :D
  14. Joshnathan

    Creating a second window using SDL

    :( well, I guess my idea will have to wait then... :( for now I will make the menu inside the same window.
  15. Hi all, my question is quite simple, how can I create a second window using SDL? I try'd void ShowMenu() { SDL_Surface *menu = SDL_SetVideoMode(200, 150, 32, SDL_HWSURFACE|SDL_DOUBLEBUF); SDL_Delay(1000); } but this erases the old one. any idea how I could create a 2nd? Thanks, Joshua P.S. if you know how, could you also tell me how to close it afterwards? :D
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!