add player moves and test image
This commit is contained in:
@@ -6,14 +6,12 @@ void keypress_do_action(t_game *game)
|
||||
if (is_esc(game->k_hook))
|
||||
shut_down(game);
|
||||
if (is_go_left(game->k_hook))
|
||||
(game->plr_x) -= 5;
|
||||
plr_posx_decrement(game);
|
||||
if (is_go_right(game->k_hook))
|
||||
(game->plr_x) += 5;
|
||||
plr_posx_increment(game);
|
||||
if (is_go_forward(game->k_hook))
|
||||
(game->plr_y) -= 5;
|
||||
plr_posy_decrement(game);
|
||||
if (is_go_backward(game->k_hook))
|
||||
(game->plr_y) += 5;
|
||||
plr_posy_increment(game);
|
||||
draw(game);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,39 +40,3 @@ int keyrelease(int keycode, t_game *game)
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* first version, cannot combine key hook
|
||||
*/
|
||||
|
||||
/*
|
||||
* static void keypress_action(int keycode, t_game *game)
|
||||
* {
|
||||
* // escape
|
||||
* if (keycode == 65307)
|
||||
* shut_down(game);
|
||||
* // left
|
||||
* if (keycode == 65361)
|
||||
* (game->plr_x) -= 5;
|
||||
* // right
|
||||
* if (keycode == 65363)
|
||||
* (game->plr_x) += 5;
|
||||
* // up
|
||||
* if (keycode == 65362)
|
||||
* (game->plr_y) -= 5;
|
||||
* // down
|
||||
* if (keycode == 65364)
|
||||
* (game->plr_y) += 5;
|
||||
* mlx_pixel_put(game->mlx_ptr, game->win_ptr, game->plr_x, game->plr_y, 0x74db74);
|
||||
* }
|
||||
*
|
||||
* int keypress(int keycode, t_game *game)
|
||||
* {
|
||||
* // temp
|
||||
* print_keycode(keycode);
|
||||
*
|
||||
* keypress_action(keycode, game);
|
||||
* return (0);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user