Jump to content
  • Advertisement

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. I am using Clamp to edge. 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: 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(); } and this is how the player, for example, moves: x += xVel * (delta / 1000.0f); Thank you for your help
  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: 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(); } and this is how the player, for example, moves: x += xVel * (delta / 1000.0f); Thank you for your help
  5. Wow, thank you Servant of the Lord. Everything works now Thanks ApochPiQ and everyone else who helped
  6. void Game::OnInit() { Map map; Player p(map); p.Init(); } void Game::OnLoop() { Map map; Player p(map); p.Move(); } Nothing compiles as it should. Here are those two functions: 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); //... }
  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. But yeah, it doesn't work. Here's the code I'm trying to compile: class Game { Map map; Player p(map); public: Game(); //... }; ... and here is the Player class header file code: class Player { Map& m; public: Player(Map& map) : m(map) {} //... };
  10. 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. class Player { Map m; public: Player(); void Init(); //... } 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: int tile[210][210]; int Map::getTile(int a, int b) { return tile[a]; } When I want to return the element in a different class, it returns 0. Also, I can't make my tilemap (tile[a]) 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. Download here: http://www.mediafire...stk7e1cep3o19u2 Video: http://www.youtube.c...bed/LnhX8YuOgfc A few screenshots: [attachment=8420:Capture.PNG] [attachment=8421:Capture.PNG] [attachment=8423:Capture3.PNG] [attachment=8422:Capture2.png]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!