Toshio

Member
  • Content count

    21
  • Joined

  • Last visited

Community Reputation

135 Neutral

About Toshio

  • Rank
    Member
  1. Thank you all, fixed the problem by moving the texture coordinates
  2. [quote name='Manabreak' timestamp='1345380483' post='4971092'] I think the artifacts are caused by wrapping. Clamping the texture to edges should prevent this. [/quote] I am using Clamp to edge. [quote name='Sponji' timestamp='1345394533' post='4971143'] The easiest way to fix those lines is probably to move the texture coordinates by 0.5 pixels. And for your timestepping problem: [url="http://gafferongames.com/game-physics/fix-your-timestep/"]http://gafferongames...-your-timestep/[/url] [/quote] How can I move the texture coordinates by pixels?
  3. Greetings. I have two problems here. First off, I'm using OpenGL with SDL. The first problem are weird lines around the transparent PNG picture as shown in the screenshot: [attachment=10761:screenshot.png] This is the PNG picture: [attachment=10762:catanimate.png] How can I make the lines disappear? The second problem is Frame Independent Movement. I got it all set up, and I thought it worked until a lot of things went happening at the same time. At some places entities move very fast, at some very slow, depending on what's rendering on screen and what logic is currently happening. Here is some code: this is main.cpp: [CODE] Uint32 delta = SDL_GetTicks(); SDL_Event event; g.OnInit(); while(g.running) { if(SDL_PollEvent(&event)) { g.OnEvent(&event); } g.OnLoop(SDL_GetTicks() - delta); delta = SDL_GetTicks(); g.OnRender(); } [/CODE] and this is how the player, for example, moves: [CODE] x += xVel * (delta / 1000.0f); [/CODE] Thank you for your help [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  4. Greetings. I have two problems here. First off, I'm using OpenGL with SDL. The first problem are weird lines around the transparent PNG picture as shown in the screenshot: [attachment=10678:screenshot.png] This is the PNG picture: [attachment=10677:catanimate.png] How can I make the lines disappear? The second problem is Frame Independent Movement. I got it all set up, and I thought it worked until a lot of things went happening at the same time. At some places entities move very fast, at some very slow, depending on what's rendering on screen and what logic is currently happening. Here is some code: this is main.cpp: [CODE] Uint32 delta = SDL_GetTicks(); SDL_Event event; g.OnInit(); while(g.running) { if(SDL_PollEvent(&event)) { g.OnEvent(&event); } g.OnLoop(SDL_GetTicks() - delta); delta = SDL_GetTicks(); g.OnRender(); } [/CODE] and this is how the player, for example, moves: [CODE] x += xVel * (delta / 1000.0f); [/CODE] Thank you for your help [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  5. Wow, thank you Servant of the Lord. Everything works now Thanks ApochPiQ and everyone else who helped
  6. [CODE] void Game::OnInit() { Map map; Player p(map); p.Init(); } void Game::OnLoop() { Map map; Player p(map); p.Move(); } [/CODE] Nothing compiles as it should. Here are those two functions: [CODE] void Player::Init() { CSurface c; x = 100; y = 100; texture = c.loadTexture("player.png"); } void Player::Move() { x += xVel * (delta / 1000.0f); y += yVel * (delta / 1000.0f); //... } [/CODE]
  7. Hmm.. It compiles now, but the initialization, loop and rendering of the Player all got messed up. None works properly.. Anyone knows why that might have happened?
  8. Ah, thank you so much. That part works now But how does the Player constructor look like in the Player code (.cpp) file?
  9. I actually do have the "Map m;" line above the "Player p;" one, just didn't write it in the post. [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] But yeah, it doesn't work. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] Here's the code I'm trying to compile: [CODE] class Game { Map map; Player p(map); public: Game(); //... }; [/CODE] ... and here is the Player class header file code: [CODE] class Player { Map& m; public: Player(Map& map) : m(map) {} //... }; [/CODE]
  10. [quote name='rnlf' timestamp='1342173357' post='4958724'] Are you sure you want every player to have her own map? Because that's what you are doing right now. What you want to do, is pass a reference to your map to the player, like this: [CODE] class Player { Map& m; public: Player(Map& map) : m(map) { ... old constructor code ... } }; in main: set up the map as you did before, then when creating the player: Player player(map); // or largeMap [/CODE] This way you only have one map for all players, all referencing the same data. If you do it the way you did, you create an empty map for every player, and one in your main, which you never use. [/quote] I've been struggling with this for a few days now. I do all it says here, but it always returns some kind of an error. The error it returns when I write as it says is: "error: 'map' is not a type" pointing to this line "Player p(map);".
  11. [CODE] class Player { Map m; public: Player(); void Init(); //... } [/CODE] I set the width and the height inside the Map class.
  12. Wow, thanks, I can make the map any size I want. But, I create the map and do all of this inside my Map class. And when again I want to get the tile in the Player class, it returns 0.
  13. Hi there. I hope someone could help me solve this problem. I suspect this is not the way to do it, but here's the code: [CODE] int tile[210][210]; int Map::getTile(int a, int b) { return tile[a][b]; } [/CODE] When I want to return the element in a different class, it returns 0. Also, I can't make my tilemap (tile[a][b]) bigger than 212 * 212. The game crashes just after it launches. Thanks for your help.
  14. I'd like to present you a tile map converter I made. It's basically a Console Application in which you type in some data and the program converts a picture (Bitmap) you loaded to a level.map file. In the level.map file you can find bunch numbers. Each of them represents a tile type you've set in the Console. It is intended for beginners but can be used by advanced users too. [size=5][b]Download here:[/b] [url="http://www.mediafire.com/download.php?stk7e1cep3o19u2"]http://www.mediafire...stk7e1cep3o19u2[/url][/size] [b]Video:[/b] [url="http://www.youtube.com/embed/LnhX8YuOgfc"]http://www.youtube.c...bed/LnhX8YuOgfc[/url] [b]A few screenshots:[/b] [attachment=8420:Capture.PNG] [attachment=8421:Capture.PNG] [attachment=8423:Capture3.PNG] [attachment=8422:Capture2.png]
  15. Anyone? [img]http://public.gamedev.net//public/style_emoticons/default/unsure.png[/img]