Draw a target for playing a nonmatching card
This commit is contained in:
		
							parent
							
								
									028da65317
								
							
						
					
					
						commit
						3bac02c752
					
				
							
								
								
									
										11
									
								
								card.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								card.c
									
									
									
									
									
								
							@ -62,7 +62,7 @@ void add_to_hand(Hand *h, Card *c) {
 | 
			
		||||
  }
 | 
			
		||||
  c->move.curve = CURVE_EASE_IN_OUT;
 | 
			
		||||
  c->move.current_time = 0.;
 | 
			
		||||
  c->move.end_time = 0.5;
 | 
			
		||||
  c->move.end_time = 0.1;
 | 
			
		||||
 | 
			
		||||
  h->count++;
 | 
			
		||||
}
 | 
			
		||||
@ -79,3 +79,12 @@ void deal(Hand *from, Hand *to, int count, bool up) {
 | 
			
		||||
    from->count--;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Rectangle next_card_position(Hand *h) {
 | 
			
		||||
  return (Rectangle) {
 | 
			
		||||
    h->position.x + ((h->count / 2) * (CARD_WIDTH + 10)),
 | 
			
		||||
    h->position.y + (h->count % 2 * (CARD_HEIGHT + 10)),
 | 
			
		||||
    CARD_WIDTH,
 | 
			
		||||
    CARD_HEIGHT
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								card.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								card.h
									
									
									
									
									
								
							@ -75,5 +75,6 @@ bool point_within_card(Card *c, Vector2 v);
 | 
			
		||||
void shuffle_hand(Hand *h);
 | 
			
		||||
void deal(Hand *from, Hand *to, int count, bool up);
 | 
			
		||||
bool card_done_moving(Card *c);
 | 
			
		||||
Rectangle next_card_position(Hand *h);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								game.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								game.c
									
									
									
									
									
								
							@ -231,10 +231,11 @@ void draw_frame(Game *g) {
 | 
			
		||||
 | 
			
		||||
  switch (g->state) {
 | 
			
		||||
  case GAME_STATE_PLAYER_CHOOSING_FROM_HAND:
 | 
			
		||||
    DrawText("Choose a card to play", 60, 485, 40, BLACK);
 | 
			
		||||
    DrawText("Choose a card to play", 60, 485, 20, BLACK);
 | 
			
		||||
    break;
 | 
			
		||||
  case GAME_STATE_PLAYER_CHOOSING_TARGET:
 | 
			
		||||
    DrawText("Choose a target on the field", 60, 485, 40, BLACK);
 | 
			
		||||
    DrawText("Choose a target on the field", 60, 485, 20, BLACK);
 | 
			
		||||
    DrawRectangleRec(next_card_position(&g->field), BLUE);
 | 
			
		||||
    break;
 | 
			
		||||
  default:
 | 
			
		||||
    break;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user