Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

839 Good

About exOfde

  • Rank

Personal Information

  • Role
  • Interests
  1. RT @lefticus: Achievement unlocked: survived #CppCon plenary
  2. Hello World, I was send via the twitter API #twitter #twitterapi
  3. If your code copy&pasted correctly you did not put the code to draw the rectangle Into the while loop. First after you left the loop you start to draw your rectangle.
  4. It could be i found my own stupid mistake... the collision detection doesn't work without coordinates. so obvious but takes more than 2 days to find ....
  5. Hello,   Since two weeks i  work with/learn to use  the artemis framework. But know i found  a problem which i can't solve by myself in my eyes. The problem is:   The function i use to detect a collision found always a collision!   Obliviously i checked the function. But there i did not find a mistake. I look also up from where i had this function ( lazyfoo.net ) but also here i cannot find a mistake. Here the function i use: bool CollisionSystem::check_collision_PP(std::vector<SDL_Rect>& A, std::vector<SDL_Rect>& B) { //The sides of the rectangles int leftA, leftB; int rightA, rightB; int topA, topB; int bottomA, bottomB; //Go through the A boxes for (int Abox = 0; Abox < A.size(); Abox++) { //Calculate the sides of rect A leftA = A[ Abox ].x; rightA = A[ Abox ].x + A[ Abox ].w; topA = A[ Abox ].y; bottomA = A[ Abox ].y + A[ Abox ].h; //Go through the B boxes for (int Bbox = 0; Bbox < B.size(); Bbox++) { //Calculate the sides of rect B leftB = B[ Bbox ].x; rightB = B[ Bbox ].x + B[ Bbox ].w; topB = B[ Bbox ].y; bottomB = B[ Bbox ].y + B[ Bbox ].h; //If no sides from A are outside of B if (((bottomA <= topB) || (topA >= bottomB) || (rightA <= leftB) || (leftA >= rightB)) == false) { //A collision is detected return true; } } } //If neither set of collision boxes touched return false; } My second idea where the error lies was the way I collect all entities to check for collision was may be the error but also here if i debug, the numbers are fine; even if i see on the screen that two entities intersect with each other the result doesn't change( which confuse me the most): void CollisionSystem::processEntity(artemis::Entity& e) { //Collect all entities of one group artemis::Bag<artemis::Entity*>* collisionbag = world->getGroupManager()->getEntities(world->getGroupManager()->getGroupOf(e)); //just in case create an Bag without gaps artemis::Bag<artemis::Entity*> bag = *collisionbag->getGapless(); if(bag.isEmpty()) throw; //looks like here is something go wrong, but what??? for(int i=0; i < bag.getCount();i++) { if(this->check_collision_PP(hitboxMapper.get(e)->box,hitboxMapper.get(*bag.get(i))->box )) std::cerr<<"Collision\n"; else std::cerr<<"Nothing\n"; } //this part works absolutly fine :D if (positionMapper.get(e)->getY() <= MinY || positionMapper.get(e)->getY() + hitboxMapper.get(e)->Height >= MaxY) { velocityMapper.get(e)->velocityY *= -1; } if (positionMapper.get(e)->getX() <= MinX || positionMapper.get(e)->getX() + hitboxMapper.get(e)->Width >= MaxX) { velocityMapper.get(e)->velocityX *= -1; } } If someone have a clue perhaps what i am doing wrong or what i could check also to find my mistake i would really appreciate it.
  6. If coding language were an essay... http://t.co/4EkDV5WcRL via @9GAG
  7. From Game Prototype to Release in 2 Months - http://t.co/uFqgByy16B
  8. C++ || Spieleprogrammierung #9 - CollisionSystem (German/Deutsch) (HD): http://t.co/zp9AvBQO2D via @YouTube
  9. exOfde

    SDL2 Not Loading/Showing Images?

    what dejaime wrote was what i actually meant
  10. exOfde

    SDL2 Not Loading/Showing Images?

      in your GUI class. you declare a pointer to an array, or a pointer to a pointer. but you never initilize it. so from where take you your surfaces? of course you load it with GUI::loadMedia but even there you just access the first pointer to the array which you has never initilized yet and try to assign a new value to it   perhaps i am wrong but that what i see ...  
  11. C++ || Spieleprogrammierung #2 - Das Framework 1.0 (German/Deutsch) (HD): http://t.co/lG8NrZe2r0 via @YouTube
  12. ZUHAUSE (WOHNUNGEN) | Das Leben in Singapur #1: http://t.co/9JOOmsxZHz #renlerntdeutsch
  • 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!