diff --git a/!RunImage,ff8 b/!RunImage,ff8 index a1ffd2b..157d8c2 100644 Binary files a/!RunImage,ff8 and b/!RunImage,ff8 differ diff --git a/Makefile,fe1 b/Makefile,fe1 index ced36f4..93549f1 100644 --- a/Makefile,fe1 +++ b/Makefile,fe1 @@ -30,14 +30,6 @@ o.Sound: C:h.swis o.Sound: C:h.kernel o.Sound: C:h.kernel 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:h.swis 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: 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 diff --git a/c/CTheEscape b/c/CTheEscape index 6e45743..ea12bf3 100644 --- a/c/CTheEscape +++ b/c/CTheEscape @@ -19,7 +19,7 @@ extern int current_element; #define DISPLAY_Y 960 #define PLAYER_Y_START 100 - +#define PLAYER_X_SPEED 10 #define MAX_NPCS 5 #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() { + game_setup_input(); game_setup_stars(); game_setup_player(); + tick = clock(); } void game_tick() { lasttick = tick; tick = clock(); + screen_flipbuffer(); screen_clear(); + game_tick_stars(); + game_input_tick(); + game_draw_stars(); game_draw_player(); - printf("%i - %i",tick - lasttick,screen); } int main(int argc, char *argv[]) @@ -193,7 +235,7 @@ int main(int argc, char *argv[]) display_mode(DISPLAY_MODE); load_sprites("Spr"); - //intro(); + intro(); display_mode(DISPLAY_MODE); diff --git a/c/Input b/c/Input index 472f4cf..40285b2 100644 --- a/c/Input +++ b/c/Input @@ -12,9 +12,9 @@ int input_readkey(int key) inreg.r[1] = key ^ 255; inreg.r[2] = 255; _kernel_swi(OS_Byte,&inreg,&outreg); - + if(outreg.r[1] == 255) return 1; - + return 0; }