mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Controls handling, tick reset after intro and player movement
This commit is contained in:
Binary file not shown.
+8
-8
@@ -30,14 +30,6 @@ o.Sound: C:h.swis
|
|||||||
o.Sound: C:h.kernel
|
o.Sound: C:h.kernel
|
||||||
o.Sound: C:h.kernel
|
o.Sound: C:h.kernel
|
||||||
o.Sound: h.Sound
|
o.Sound: h.Sound
|
||||||
o.Input: c.Input
|
|
||||||
o.Input: C:h.swis
|
|
||||||
o.Input: C:h.kernel
|
|
||||||
o.Input: C:h.kernel
|
|
||||||
o.Input: c.Input
|
|
||||||
o.Input: C:h.swis
|
|
||||||
o.Input: C:h.kernel
|
|
||||||
o.Input: C:h.kernel
|
|
||||||
o.Graphics: c.Graphics
|
o.Graphics: c.Graphics
|
||||||
o.Graphics: C:h.swis
|
o.Graphics: C:h.swis
|
||||||
o.Graphics: C:h.kernel
|
o.Graphics: C:h.kernel
|
||||||
@@ -56,3 +48,11 @@ o.CTheEscape: C:h.swis
|
|||||||
o.CTheEscape: C:h.kernel
|
o.CTheEscape: C:h.kernel
|
||||||
o.CTheEscape: C:h.kernel
|
o.CTheEscape: C:h.kernel
|
||||||
o.CTheEscape: h.Sound
|
o.CTheEscape: h.Sound
|
||||||
|
o.Input: c.Input
|
||||||
|
o.Input: C:h.swis
|
||||||
|
o.Input: C:h.kernel
|
||||||
|
o.Input: C:h.kernel
|
||||||
|
o.Input: c.Input
|
||||||
|
o.Input: C:h.swis
|
||||||
|
o.Input: C:h.kernel
|
||||||
|
o.Input: C:h.kernel
|
||||||
|
|||||||
+45
-3
@@ -19,7 +19,7 @@ extern int current_element;
|
|||||||
#define DISPLAY_Y 960
|
#define DISPLAY_Y 960
|
||||||
|
|
||||||
#define PLAYER_Y_START 100
|
#define PLAYER_Y_START 100
|
||||||
|
#define PLAYER_X_SPEED 10
|
||||||
#define MAX_NPCS 5
|
#define MAX_NPCS 5
|
||||||
#define MAX_STARS 49
|
#define MAX_STARS 49
|
||||||
|
|
||||||
@@ -168,22 +168,64 @@ void game_setup_stars()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void game_setup_input()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
inreg.r[0] = 4;
|
||||||
|
inreg.r[1] = 1;
|
||||||
|
_kernel_swi(OS_Byte,&inreg,&outreg);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void game_input_tick()
|
||||||
|
{
|
||||||
|
// Right arrow
|
||||||
|
if(input_readkey(121))
|
||||||
|
{
|
||||||
|
Player.location.X += PLAYER_X_SPEED * (tick - lasttick);
|
||||||
|
Player.sprite = player_shipr;
|
||||||
|
// TODO: SHIP WIDTH
|
||||||
|
if(Player.location.X > DISPLAY_X)
|
||||||
|
{
|
||||||
|
Player.location.X = DISPLAY_X;
|
||||||
|
Player.sprite = player_ship;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Left arrow
|
||||||
|
if(input_readkey(25))
|
||||||
|
{
|
||||||
|
Player.location.X -= PLAYER_X_SPEED * (tick - lasttick);
|
||||||
|
Player.sprite = player_shipl;
|
||||||
|
if(Player.location.X < 0)
|
||||||
|
{
|
||||||
|
Player.location.X = 0;
|
||||||
|
Player.sprite = player_ship;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void game_setup()
|
void game_setup()
|
||||||
{
|
{
|
||||||
|
game_setup_input();
|
||||||
game_setup_stars();
|
game_setup_stars();
|
||||||
game_setup_player();
|
game_setup_player();
|
||||||
|
tick = clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_tick()
|
void game_tick()
|
||||||
{
|
{
|
||||||
lasttick = tick;
|
lasttick = tick;
|
||||||
tick = clock();
|
tick = clock();
|
||||||
|
|
||||||
screen_flipbuffer();
|
screen_flipbuffer();
|
||||||
screen_clear();
|
screen_clear();
|
||||||
|
|
||||||
game_tick_stars();
|
game_tick_stars();
|
||||||
|
game_input_tick();
|
||||||
|
|
||||||
game_draw_stars();
|
game_draw_stars();
|
||||||
game_draw_player();
|
game_draw_player();
|
||||||
printf("%i - %i",tick - lasttick,screen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -193,7 +235,7 @@ int main(int argc, char *argv[])
|
|||||||
display_mode(DISPLAY_MODE);
|
display_mode(DISPLAY_MODE);
|
||||||
load_sprites("Spr");
|
load_sprites("Spr");
|
||||||
|
|
||||||
//intro();
|
intro();
|
||||||
|
|
||||||
display_mode(DISPLAY_MODE);
|
display_mode(DISPLAY_MODE);
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ int input_readkey(int key)
|
|||||||
inreg.r[1] = key ^ 255;
|
inreg.r[1] = key ^ 255;
|
||||||
inreg.r[2] = 255;
|
inreg.r[2] = 255;
|
||||||
_kernel_swi(OS_Byte,&inreg,&outreg);
|
_kernel_swi(OS_Byte,&inreg,&outreg);
|
||||||
|
|
||||||
if(outreg.r[1] == 255)
|
if(outreg.r[1] == 255)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user