# exOfde

Member

83

839 Good

• Rank
Member

• Role
Programmer
• Interests
DevOps
Education
Programming
1. ## exOfde

RT @lefticus: Achievement unlocked: survived #CppCon plenary

4. ## Need Help Fixing Problem With Simple Program(Python/Pygame)

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.
5. ## Collision detection with an ECS

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 ....
6. ## Collision detection with an ECS

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.
7. ## exOfde

If coding language were an essay... http://t.co/4EkDV5WcRL via @9GAG
8. ## exOfde

From Game Prototype to Release in 2 Months - http://t.co/uFqgByy16B

10. ## exOfde

C++ || Spieleprogrammierung #9 - CollisionSystem (German/Deutsch) (HD): http://t.co/zp9AvBQO2D via @YouTube

what dejaime wrote was what i actually meant

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 ...

14. ## exOfde

C++ || Spieleprogrammierung #2 - Das Framework 1.0 (German/Deutsch) (HD): http://t.co/lG8NrZe2r0 via @YouTube
15. ## exOfde

ZUHAUSE (WOHNUNGEN) | Das Leben in Singapur #1: http://t.co/9JOOmsxZHz #renlerntdeutsch