Making the speed a float number
This commit is contained in:
		
							parent
							
								
									d7c3a55068
								
							
						
					
					
						commit
						49d3d1ceed
					
				|  | @ -22,7 +22,7 @@ struct TransformComponent : public Component { | ||||||
|         position.zero(); |         position.zero(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     TransformComponent(Vector2D<float> pos, Vector2D<int> dim, int sc, int spd) : position(pos), speed(spd), dimension(dim), scale(sc) |     TransformComponent(Vector2D<float> pos, Vector2D<int> dim, int sc, float spd) : position(pos), speed(spd), dimension(dim), scale(sc) | ||||||
|     {} |     {} | ||||||
| 
 | 
 | ||||||
|     void init() override |     void init() override | ||||||
|  | @ -32,7 +32,7 @@ struct TransformComponent : public Component { | ||||||
| 
 | 
 | ||||||
|     void update() override |     void update() override | ||||||
|     { |     { | ||||||
|         position += (velocity * static_cast<float>(speed)); |         position += (velocity * speed); | ||||||
| 
 | 
 | ||||||
|         entity->draw_priority = static_cast<int>(position.y + static_cast<float>(dimension.y * scale)); |         entity->draw_priority = static_cast<int>(position.y + static_cast<float>(dimension.y * scale)); | ||||||
|     } |     } | ||||||
|  | @ -40,7 +40,7 @@ struct TransformComponent : public Component { | ||||||
|     Vector2D<float> position; |     Vector2D<float> position; | ||||||
| 
 | 
 | ||||||
|     Vector2D<float> velocity; |     Vector2D<float> velocity; | ||||||
|     int speed {1}; |     float speed {1}; | ||||||
| 
 | 
 | ||||||
|     Vector2D<int> dimension {32, 32}; |     Vector2D<int> dimension {32, 32}; | ||||||
|     int scale {1}; |     int scale {1}; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue