[main.c] Fix friction? Restored ice

This commit is contained in:
KikooDX 2020-05-19 14:09:19 +02:00
parent a90553fb18
commit f92fb66cd8
9 changed files with 12 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 171 B

View File

@ -12,7 +12,7 @@ extern image_t img_solid_0; //solid texture, 16x16
extern image_t img_solid_1; //solid texture, 16x16
extern image_t img_spike; //spike texture, 16x16
extern image_t img_bouncer; //bouncer texture, 16x16
extern image_t img_ice; //ice texture, 16x8
extern image_t img_ice; //ice texture, 16x16
extern image_t img_blue; //blue bloc texture, 16x16
extern image_t img_blue_dot; //off blue bloc texture, 16x16
extern image_t img_red; //red bloc texture, 16x16
@ -72,7 +72,6 @@ int *start_y, int tp_positions[])
draw_anim(x, y, &img_bouncer, step);
break;
case '~':
draw_anim(x, y, &img_solid_0, step);
draw_anim(x, y, &img_ice, step);
break;
case '/':

View File

@ -11,7 +11,7 @@
#include "shared_define.h"
#define MAX_HSPD 2.0
#define DRILL_HSPD 4.5
#define DRILL_HSPD 6.0
#define ACCELERATION 1.0
#define DECELERATION 0.5
#define MIN_VSPD -12.0
@ -145,7 +145,7 @@ int main(void)
int trunc_hspd;
//ice
if (collide(player_x, player_y + 1, level, '~')) friction = 0.2;
move = keydown(KEY_RIGHT) + 0 - keydown(KEY_LEFT);
move = keydown(KEY_RIGHT) - keydown(KEY_LEFT);
if (move) {
if (hspd < MAX_HSPD)
{
@ -159,6 +159,12 @@ int main(void)
else hspd -= DECELERATION / 4 * friction;
if (hspd < 0) hspd = 0;
}
else if (hspd < 0)
{
if (friction != 0.2) hspd += DECELERATION * friction;
else hspd += DECELERATION / 4 * friction;
if (hspd > 0) hspd = 0;
}
trunc_hspd = hspd * direction;
if (1) //glue was here
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

View File

@ -9,6 +9,7 @@ tiles = {
love.graphics.newImage(img_path.."elevator.png"),
love.graphics.newImage(img_path.."water.png"),
love.graphics.newImage(img_path.."bouncer.png"),
love.graphics.newImage(img_path.."ice.png"),
love.graphics.newImage(img_path.."semi_solid.png"),
love.graphics.newImage(img_path.."teleporter_0.png"),
love.graphics.newImage(img_path.."teleporter_1.png"),
@ -16,7 +17,7 @@ tiles = {
love.graphics.newImage(img_path.."spawn.png"),
love.graphics.newImage(img_path.."exit.png"),
}
tiles_char = { '0', '1', 'r', 'b', 'v', '^', 'w', '*', '/', 't', 'T', 'd', 'S',
'E' }
tiles_char = { '0', '1', 'r', 'b', 'v', '^', 'w', '*', '~', '/', 't', 'T', 'd',
'S', 'E' }
selected_tile = 1