+ 7

How to over a game ?

If I want to over the game on collisions which function should I use? ** Without js libraries

26th Jun 2019, 5:21 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
10 odpowiedzi
+ 11
Prince PS Well, for game over in collision, you need to measure distance between two objects at certain interval (according to your game). If the distance between two objects is zero or less than that, you execute/call the game over function that you have created. I am not really a game developer and good mathematician, but I know some concepts. I guess, my friends know about that, as your question is related to game development and mathematics Coder Prometheus {#Stand_out_from_the_crowd} 🇸🇬 r8w9 Haris ( exams )
27th Jun 2019, 3:02 AM
Sarthak Pokhrel
Sarthak Pokhrel - avatar
26th Jun 2019, 4:03 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 6
Coder I have created just a simple version of flappy ball but I want to add a few things such as score board , collisions , game reload on collisions . One more thing , as I am new to canvas games and JavaScript that's why I Haven t used class or constructors . I have just made this using a single draw function. Can you please give me some suggestions on making the game more efficient and syntax - easier without using much functions . https://code.sololearn.com/WaR7M3trpp39/?ref=app Thanks
27th Jun 2019, 6:48 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 6
Coder Ok see now I have added collisions without libraries as I have just given some conditions for game over . I have also added the score board that will be given in the last . Thanks for suggestions.😊😊🙏🙏
27th Jun 2019, 10:35 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 6
Coder but I want that if the game is over , the code will ask user whether if he wants to reload or not. If the user enters 1 , the game will reload but I don't know how to reload the game. I have also tried document.location.reload() to reload the page but that doesn't works. That's why I have just defined a function which has no existence so it will give error. and will stop but that's not the solution Please help!
27th Jun 2019, 10:39 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 5
Well Coder , I tried to reload the position of the player but that doesn't work . There is a big problem that if the player is reloaded and if by chance , it's inside the pipe obstacle then again the game will crash and the player will be assign that value only now the loop will run Untill the player is out of pipe and that's a big problem!
28th Jun 2019, 6:09 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 3
You questioned twice same question
26th Jun 2019, 5:44 AM
Sarthak Pokhrel
Sarthak Pokhrel - avatar