Jump to content
  • Advertisement

lvenonl

Member
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

163 Neutral

About lvenonl

  • Rank
    Member
  1. lvenonl

    Placing enemies in the map/world

    Thanks for the quick reply guys!     Well, I am not using any map editor. I could, but that would be just to place enemies         I've been thinking of using json as BeerNutts said, then I just get the elapsed time and place different waves with different combination of enemies. Removing the timed waves and just spawn new waves once the player defeats every enemies in the current one seems a nice approach as well.   The problem is: As you said, this is rather a game design question and that's something that I need to improve...
  2. Hi!   I am currently creating a space shooter for practicing purposes and I got stuck on how to efficiently place enemies in the map and create a level.   One way is to hard code the enemies' positions on the map but that would obviously take too much time to create new levels and test the gameplay (level of difficulty more precisely). I could also make random waves throughout the map but I'm considering this, my last resource since it'd be too 'inconsistent'.   Could someone help with some ideas on how to do it?   EDIT: I am using SFML btw (forgot to mention )
  3. lvenonl

    Moving sprite around point

      Nope! I put that underscore there by mistake, on my code it is "dT" hahahaha I double checked it, tried to do everything all over again, but I still get the sprite not rotating at all
  4. lvenonl

    Moving sprite around point

      Now I've got the sprite not moving at all I did the same logic you did, except I didn't add a class CTimer, I just added these variables (as floats) to my Enemy update function: fB = fA; fA = SDL_GetTicks(); dT = (fA - fB) / 1000.0f; And modified my moveInCircle function to take dT as an argument void moveInCircle(Vector2D* enemyPos, float speed, int centerX, int centerY, int radius, float* currentAngle, float limit, float dT) { float speedScale = (0.001 * 2 * PI) / speed; float angle = d_t * speedScale; std::cout << *currentAngle << "\n"; if(*currentAngle + angle <= limit) { *currentAngle += angle; enemyPos->SetX(centerX + sin(angle) * radius); enemyPos->SetY(centerY + cos(angle) * radius); } } What am I doing wrong?
  5. lvenonl

    Moving sprite around point

    Actually it stops around 90 degrees away from the 'target'. One strange thing is that printing out the 'currentAngle' value I noticed that at first 'angle' adds around 0.5 to currentAngle, then it starts adding 1, and suddenly it adds 2 every time it passes through the function. I think it's something wrong with the way I'm calculating the 'angle' variable, I just don't know what.
  6. lvenonl

    Moving sprite around point

    Thanks for the answer guys! I appreciate it!   I made this modifications: void moveInCircle(Vector2D* enemyPos, float speed, int centerX, int centerY, int radius, float* currentAngle, float limit) { float speedScale = (0.001 * 2 * PI) / speed; float angle = SDL_GetTicks() * speedScale; if(*currentAngle + angle < limit) { *currentAngle += angle; enemyPos->SetX(centerX + sin(angle) * radius); enemyPos->SetY(centerY + cos(angle) * radius); } } And in my update function: if(currentAngle < 360) { moveInCircle(&position, 4, 100, 100, 100, &currentAngle, 360); } But the enemy is not completing a full 360º rotation. I think I'm missing something pretty simple and stupid! LOL
  7. Hello guys,   I am trying to rotate a sprite around a specific point on the screen. I managed to do so and here is what I have so far:   My Enemy update function: void Enemy::update() { moveInCircle(&position, 1, 100, 100, 100); { My function to move sprite around point: void moveInCircle(Vector2D* enemyPos, float speed, int centerX, int centerY, int radius) { float speedScale = (0.001 * 2 * PI) / speed; float angle = SDL_GetTicks() * speedScale; enemyPos->SetX(centerX + sin(angle) * radius); enemyPos->SetY(centerY + cos(angle) * radius); } However, I want to be able to rotate the sprite in a limited angle, instead of just moving ad infinitum and here is where I got stuck, how can I check how many degrees the sprite have moved? Maybe there is a better approach on the function 'moveInCircle' than the one I used?   Thanks in advance, lvenonl
  8. lvenonl

    Key input delay

        I did it! I already had my own function that returned 1 for key is down, 0 for key is being released and -1 for key is not being used. What I did, I just put a variable in the beginning of my update function: frameStart = SDL_GetTicks(); Then I had my function update it using a variable to hold the current frame time and compare it with my delay: if(GetKeyboardInput(SDL_SCANCODE_SPACE, event) == 1) { frameTime += frameStart; if(frameTime >= fireDelay) { missiles.push_back(new Missile()); missiles.back()->load("misslie", (position.GetX() + srcRect.w / 2), position.GetY(), renderer); frameTime -= fireDelay; } } Thanks a lot mate!
  9. lvenonl

    Key input delay

    Hi guys,   How do I put a delay on a key input in SDL? For example: On a shoot 'em up game, if the player holds the fire button, there should be a delay between each missile created by his space ship.    
  10. lvenonl

    Data-driven design?

      Sorry, not too familiar with RapidJSON, but as far as alternatives... perhaps you may like JsonCPP ?     JsonCPP is better! Could use it without a problem! I think I'll use JSON...it's easier to write than XML!   Thanks for the help guys! I really appreciate it!
  11. lvenonl

    Data-driven design?

    Thanks for all the information guys!   I'm making some tests with both XML and JSON to see which of them I like the most. I managed to implement XML in my game using TinyXML.   However, I'm having issues with JSON, I'm using RapidJson and I got some errors with their headers when parsing the file and reading it: d:\sdl\include\rapidjson\reader.h(392): error C2228: left of '.Peek' must have class/struct/union Does anyone know how to solve it? Maybe there's a better library for json?  
  12. lvenonl

    Data-driven design?

        I see! It looks more efficient!   Just one more question: Is XML a good option for data files? Do you recommend any other data file instead of XML to use for a 2D game?
  13. lvenonl

    Data-driven design?

    Hello,   I've been studying game programming with SDL and I came across a very interesting subject which is the Data-driven design. I searched around the web and I found lots of definitions and approaches about it and I didn't understand it very well. What is it exactly? How can it be used in game programming?   Thanks in advance   lvenonl
  14. lvenonl

    Starting out

    Well, I forgot to mention, but I do have some experience with programming. I have the basics of C++, I also made a Text-based RPG and a simple shoot'em up using XNA (had some bugs with collision though LOL). I also have 2 games on UDK, one of 'em is just a simple 'puzzle' game and the other is a Racing which I did using UnrealScript. Just one track, one opponent BOT and the HUD counting Laps and Position. I was on a course based on Autodesk Maya and UDK back in the day (I was 13 years old i think). So, yea! I do want to be a programmer! That's my dream since I was a kid.   My brother, he did this course with me. Later on he studied Graphic Design in the university, sadly he had to quit with just 1 year left to finish it 'cause we moved to the UK. I didn't start studying in the university yet, I think I'll start next year with my brother. Meanwhile, we're willing to study by ourselves so that we don't lose time.   I'm just not sure which language to focus on. I might need to study a little bit more before starting this project, I want to be sure which language though. We're thinking about a side-scroller game, with a gameplay based on Castlevania or something like that (don't worry, it's not a vampire or zombie based story LMAO)       Anyway, what do you recommend? Which language? Should I use an Engine? I just want to make the right choice LOL   Thanks for the answer, I really appreciate it mate!
  15. lvenonl

    Starting out

    Hello guys,   I'm about to start a game project with my brother, I'll be the programmer and he'll be the graphic designer. For our first game, we're thinking of doing it 2D because it looks easier for beginners and it suits more for our current idea. For the language, we're thinking about C++ or LUA   My question is: Which one is the best, LUA or C++? We're thinking about using Unreal Engine 4 in the future, because of that, I was considering C++ but maybe I can go with LUA and get C++ later?   Also, should I use LOVE or Torque 2D? Which one of 'em is the best (for learning, improving skills, flexibility, documentation, updates etc) ? Maybe you recommend another game engine?   Thanks in advance, lvenonl
  • 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!