Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/space-dragon.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2014-10-12 15:03:44 +0400
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2014-10-12 15:03:44 +0400
commitf3be72d9ed9854d9b8e709fe473a4f92dd9080fe (patch)
treeed7a9cfbf043dcda261ee0863a469d10d182a71c /src
parentab77a6a705c7cdf938117a24c8158c53db2e0611 (diff)
Smooth movement, new version.
Diffstat (limited to 'src')
-rw-r--r--src/game.c8
-rw-r--r--src/game.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/game.c b/src/game.c
index df4e80f..affca32 100644
--- a/src/game.c
+++ b/src/game.c
@@ -245,9 +245,11 @@ void update_timer(void* data)
acc_y = acc.y;
// Moving ship
- speed_x = acc_x / 32;
- speed_y = -acc_y / 32;
- ship_x += speed_x;
+ speed_x = acc_x / 32.0;
+ speed_y = -acc_y / 32.0;
+ if (speed_x >= ACC_DEATH_ZONE || speed_x <= -ACC_DEATH_ZONE)
+ ship_x += speed_x;
+ if (speed_y >= ACC_DEATH_ZONE || speed_y <= -ACC_DEATH_ZONE)
ship_y += speed_y;
// Some limits
diff --git a/src/game.h b/src/game.h
index 1e2d342..153c31e 100644
--- a/src/game.h
+++ b/src/game.h
@@ -1,7 +1,8 @@
#ifndef _GAME_H_
#define _GAME_H_
-#define VERSION "v1.4"
+#define VERSION "v1.5"
+#define ACC_DEATH_ZONE 0.5
#define SHIP_WIDTH 10
#define SHIP_HEIGHT 15
#define SCREEN_WIDTH 144