Advertisement
Guest User

shit code (literally) xddd

a guest
Jan 19th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. void Game::UpdateModel()
  2. {
  3. if( isStarted )
  4. {
  5. if( wnd.kbd.KeyIsPressed( VK_RIGHT ) )
  6. {
  7. dudeX += 1;
  8. }
  9. if( wnd.kbd.KeyIsPressed( VK_LEFT ) )
  10. {
  11. dudeX -= 1;
  12. }
  13. if( wnd.kbd.KeyIsPressed( VK_DOWN ) )
  14. {
  15. dudeY += 1;
  16. }
  17. if( wnd.kbd.KeyIsPressed( VK_UP ) )
  18. {
  19. dudeY -= 1;
  20. }
  21.  
  22. dudeX = ClampScreenX( dudeX,dudeWidth );
  23. dudeY = ClampScreenY( dudeY,dudeHeight );
  24.  
  25. poo0X += poo0vx;
  26. poo0Y += poo0vy;
  27. poo1X += poo1vx;
  28. poo1Y += poo1vy;
  29. poo2X += poo2vx;
  30. poo2Y += poo2vy;
  31.  
  32. {
  33. const int poo0Xold = poo0X;
  34. const int poo0Yold = poo0Y;
  35.  
  36. poo0X = ClampScreenX( poo0X,pooWidth );
  37. if( poo0X != poo0Xold )
  38. {
  39. poo0vx = -poo0vx;
  40. }
  41. poo0Y = ClampScreenY( poo0Y,pooHeight );
  42. if( poo0Y != poo0Yold )
  43. {
  44. poo0vy = -poo0vy;
  45. }
  46. }
  47. {
  48. const int poo1Xold = poo1X;
  49. const int poo1Yold = poo1Y;
  50.  
  51. poo1X = ClampScreenX( poo1X,pooWidth );
  52. if( poo1X != poo1Xold )
  53. {
  54. poo1vx = -poo1vx;
  55. }
  56. poo1Y = ClampScreenY( poo1Y,pooHeight );
  57. if( poo1Y != poo1Yold )
  58. {
  59. poo1vy = -poo1vy;
  60. }
  61. }
  62. {
  63. const int poo2Xold = poo2X;
  64. const int poo2Yold = poo2Y;
  65.  
  66. poo2X = ClampScreenX( poo2X,pooWidth );
  67. if( poo2X != poo2Xold )
  68. {
  69. poo2vx = -poo2vx;
  70. }
  71. poo2Y = ClampScreenY( poo2Y,pooHeight );
  72. if( poo2Y != poo2Yold )
  73. {
  74. poo2vy = -poo2vy;
  75. }
  76. }
  77.  
  78. if( IsColliding( dudeX,dudeY,dudeWidth,dudeHeight,poo0X,poo0Y,pooWidth,pooHeight ) )
  79. {
  80. poo0IsEaten = true;
  81. }
  82. if( IsColliding( dudeX,dudeY,dudeWidth,dudeHeight,poo1X,poo1Y,pooWidth,pooHeight ) )
  83. {
  84. poo1IsEaten = true;
  85. }
  86. if( IsColliding( dudeX,dudeY,dudeWidth,dudeHeight,poo2X,poo2Y,pooWidth,pooHeight ) )
  87. {
  88. poo2IsEaten = true;
  89. }
  90. }
  91. else
  92. {
  93. if( wnd.kbd.KeyIsPressed( VK_RETURN ) )
  94. {
  95. isStarted = true;
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement