Added the ability to discard cards in a hand and other various changes.
This commit is contained in:
+13
-15
@@ -3,6 +3,7 @@
|
||||
#include <maxmod.h>
|
||||
#include <tonc.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sprite.h"
|
||||
#include "card.h"
|
||||
@@ -14,24 +15,13 @@ void game_init()
|
||||
|
||||
void game_update()
|
||||
{
|
||||
static int timer = 0;
|
||||
timer++;
|
||||
|
||||
if (timer % 12 == 0)
|
||||
{
|
||||
card_draw();
|
||||
}
|
||||
|
||||
static int hand_index_selected = 0;
|
||||
if (key_hit(KEY_LEFT))
|
||||
{
|
||||
hand_index_selected++;
|
||||
hand_index(hand_index_selected);
|
||||
hand_set_focus(hand_get_focus() + 1); // The reason why this adds 1 is because the hand is drawn from right to left. There is no particular reason for this, it's just how I did it.
|
||||
}
|
||||
if (key_hit(KEY_RIGHT))
|
||||
else if (key_hit(KEY_RIGHT))
|
||||
{
|
||||
hand_index_selected--;
|
||||
hand_index(hand_index_selected);
|
||||
hand_set_focus(hand_get_focus() - 1);
|
||||
}
|
||||
|
||||
if (key_hit(KEY_A))
|
||||
@@ -39,8 +29,16 @@ void game_update()
|
||||
hand_select();
|
||||
}
|
||||
|
||||
if (key_hit(KEY_SELECT))
|
||||
if (key_hit(KEY_B))
|
||||
{
|
||||
hand_change_sort();
|
||||
}
|
||||
|
||||
if (key_hit(KEY_SELECT))
|
||||
{
|
||||
hand_discard();
|
||||
}
|
||||
|
||||
tte_printf("#{es; P:128,130}%d/%d", hand_get_size(), hand_get_max_size());
|
||||
tte_printf("#{P:200,155}%d/%d", deck_get_size(), deck_get_max_size());
|
||||
}
|
||||
Reference in New Issue
Block a user