dekar avatar dekar committed d32555e

work on collisions

Comments (0)

Files changed (2)

include/ct-level.hpp

         Block::Ptr	createBlock();
         bool		loadTextures();
 
-        void    keyListener(Application::EventData* event);
-        void    resetGame();
-        void    pause(bool state);
-        Block*  createFallingBlock();
+        void            keyListener(Application::EventData* event);
+        void            resetGame();
+        void            pause(bool state);
+        Block::Ptr      createFallingBlock();
+        bool            checkCollision(const Block::Ptr b1, const Block::Ptr p2);
 
         LevelDesc				mLevelDesc;
         std::string			        mBlockTexturesPath;
         if (!mPaused) {
                 for (auto it1 = mBlocks.begin(); it1 != mBlocks.end(); ++it1) {
                         for (auto it2 = mBlocks.begin(); it2 != mBlocks.end(); ++it2) {
-                                //if (check
+                                if (checkCollision(*it1, *it2)) {
+                                        (*it1)->onCollide();
+                                }
                         }
                 }
                 for (auto it = mBlocks.begin(); it != mBlocks.end(); ++it) {
         }
 }
 
+bool Level::checkCollision(const Block::Ptr b1, const Block::Ptr p2)
+{
+        return false;
+}
+
 void Level::renderField()
 {
 	Primitive p;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.