Id: | To index | |
Original: | Legend | |
Status: | ||
Mutant: | Show |
Testcases to display
Filter by kind
Filter by status
1: # include "physicssystem.h" |
2: |
3: # include "game.h" |
4: |
5: void PhysicsSystem :: update ( ) { |
6: for ( auto & ph : game_ . physics . values ( ) ) { |
7: if ( ph . type == PhysicsType :: Projectile ) { |
8: ph . position += ph . velocity ; |
9: ph . velocity *= 0.95 ; |
10: // TODO: detect collisions |
11: } |
12: |
13: // Update position of sprite |
14: auto & e = game_ . entities [ ph . entity ] ; |
15: if ( e . sprite ) { |
16: auto & sprite = game_ . sprites [ e . sprite ] ; |
17: sprite . position = ( vec2i ) ph . position ; |
18: } |
19: } |
20: } |