From 0bf52403fb26f33d7254daa3329a2e164f041d92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Gl=C3=A4=C3=9Fer?= Date: Tue, 24 Feb 2004 15:34:00 +0000 Subject: [PATCH] gameplay improvements SVN-Revision: 148 --- src/gameloop.c | 6 +++--- src/gameloop.h | 7 ------- src/player.c | 32 ++++++++++++++++++-------------- src/scene.c | 4 ++++ src/scene.h | 8 ++++++++ src/world.c | 4 ++-- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/gameloop.c b/src/gameloop.c index 54b1c03ce..9b2d00d4e 100644 --- a/src/gameloop.c +++ b/src/gameloop.c @@ -1457,7 +1457,7 @@ void trybreakbrick(float x, float y) { /* Get a distro from it: */ - add_bouncy_distro(((x + 1) / 32) * 32, + add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32); if (counting_distros == NO) @@ -1519,7 +1519,7 @@ void tryemptybox(float x, float y) /* Box with a distro! */ - add_bouncy_distro(((x + 1) / 32) * 32, + add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); @@ -1576,7 +1576,7 @@ void trygrabdistro(float x, float y, int bounciness) if (bounciness == BOUNCE) { - add_bouncy_distro(((x + 1) / 32) * 32, + add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32); } diff --git a/src/gameloop.h b/src/gameloop.h index ce8b9a283..8c6fbeeda 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -44,13 +44,6 @@ void trygrabdistro(float x, float y, int bounciness); void trybreakbrick(float x, float y); void tryemptybox(float x, float y); void trybumpbadguy(float x, float y); -void add_bouncy_distro(float x, float y); -void add_broken_brick(float x, float y); -void add_broken_brick_piece(float x, float y, float xm, float ym); -void add_bouncy_brick(float x, float y); -void add_bad_guy(float x, float y, int kind); -void add_upgrade(float x, float y, int kind); -void add_bullet(float x, float y, float xm, int dir); #endif /*SUPERTUX_GAMELOOP_H*/ diff --git a/src/player.c b/src/player.c index 459865cc1..0b8fb6147 100644 --- a/src/player.c +++ b/src/player.c @@ -211,10 +211,10 @@ void player_action(player_type* pplayer) if (shape(pplayer->base.x, pplayer->base.y - 1) == 'x' || shape(pplayer->base.x, pplayer->base.y - 1) == 'y') { - add_bouncy_distro(((pplayer->base.x+ 1) + add_bouncy_distro((((int)pplayer->base.x) / 32) * 32, - (int)(pplayer->base.y - 1 / 32) * 32); - + ((int)pplayer->base.y - 1 / 32) * 32); +DEBUG_MSG("should work"); if (counting_distros == NO) { counting_distros = YES; @@ -231,10 +231,10 @@ void player_action(player_type* pplayer) else if (shape(pplayer->base.x+ 31, pplayer->base.y - 1) == 'x' || shape(pplayer->base.x+ 31, pplayer->base.y - 1) == 'y') { - add_bouncy_distro(((pplayer->base.x+ 1 + 31) + add_bouncy_distro((((int)pplayer->base.x + 31) / 32) * 32, - (int)(pplayer->base.y - 1 / 32) * 32); - + ((int)pplayer->base.y - 1 / 32) * 32); +DEBUG_MSG("+31?"); if (counting_distros == NO) { counting_distros = YES; @@ -862,12 +862,12 @@ void player_input(player_type *pplayer) { player_handle_horizontal_input(pplayer,LEFT); } - else + else { - if(pplayer->base.xm > 0) - pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); - else if(pplayer->base.xm < 0) - pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); + if(pplayer->base.xm > 0) + pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); + else if(pplayer->base.xm < 0) + pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); } /* Jump/jumping? */ @@ -934,11 +934,15 @@ void player_grabdistros(player_type *pplayer) trygrabdistro(pplayer->base.x, pplayer->base.y, NO_BOUNCE); trygrabdistro(pplayer->base.x+ 31, pplayer->base.y, NO_BOUNCE); - if (pplayer->size == BIG && !pplayer->duck) + trygrabdistro(pplayer->base.x, pplayer->base.y + pplayer->base.height, NO_BOUNCE); + trygrabdistro(pplayer->base.x+ 31, pplayer->base.y + pplayer->base.height, NO_BOUNCE); + + if(pplayer->size == BIG) { - trygrabdistro(pplayer->base.x, pplayer->base.y - 32, NO_BOUNCE); - trygrabdistro(pplayer->base.x+ 31, pplayer->base.y - 32, NO_BOUNCE); + trygrabdistro(pplayer->base.x, pplayer->base.y + pplayer->base.height / 2, NO_BOUNCE); + trygrabdistro(pplayer->base.x+ 31, pplayer->base.y + pplayer->base.height / 2, NO_BOUNCE); } + } diff --git a/src/scene.c b/src/scene.c index 92c8c2d92..e43e3d90f 100644 --- a/src/scene.c +++ b/src/scene.c @@ -125,6 +125,10 @@ void add_score(float x, float y, int s) void add_bouncy_distro(float x, float y) { + + +printf("X _--- %f Y-- isdojf %f\n",x,y); + int i, found; found = -1; diff --git a/src/scene.h b/src/scene.h index 52e7ce736..923156fdf 100644 --- a/src/scene.h +++ b/src/scene.h @@ -50,4 +50,12 @@ void set_defaults(void); void arrays_init(void); void arrays_free(void); +void add_bouncy_distro(float x, float y); +void add_broken_brick(float x, float y); +void add_broken_brick_piece(float x, float y, float xm, float ym); +void add_bouncy_brick(float x, float y); +void add_bad_guy(float x, float y, int kind); +void add_upgrade(float x, float y, int kind); +void add_bullet(float x, float y, float xm, int dir); + #endif /*SUPERTUX_SCENE_H*/ diff --git a/src/world.c b/src/world.c index 37af9bb9b..3988a3f4e 100644 --- a/src/world.c +++ b/src/world.c @@ -25,7 +25,7 @@ void bouncy_distro_init(bouncy_distro_type* pbouncy_distro, float x, float y) pbouncy_distro->base.alive = YES; pbouncy_distro->base.x = x; pbouncy_distro->base.y = y; - pbouncy_distro->base.ym = -6; + pbouncy_distro->base.ym = -2; } void bouncy_distro_action(bouncy_distro_type* pbouncy_distro) @@ -34,7 +34,7 @@ void bouncy_distro_action(bouncy_distro_type* pbouncy_distro) { pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym * frame_ratio; - pbouncy_distro->base.ym += 1. * frame_ratio; + pbouncy_distro->base.ym += 0.1 * frame_ratio; if (pbouncy_distro->base.ym >= 0) pbouncy_distro->base.alive = NO; -- 2.11.0