summaryrefslogtreecommitdiff
path: root/src/interface.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-18 07:14:53 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-18 07:14:53 (GMT)
commit039a4e2f31daa4863c35670d682acbe0781b5654 (patch)
treeee899d8e437b0c34351bcb97ce507264f75c1f05 /src/interface.c
parent809676a1dcfb79ad9b2fa8043d553f9f7961680d (diff)
downloadpowder-039a4e2f31daa4863c35670d682acbe0781b5654.zip
powder-039a4e2f31daa4863c35670d682acbe0781b5654.tar.gz
Added second stickman for Lulz, it works great though, controlled by wasd. 's' was moved to ctrl-s and d is ctrl-d
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/interface.c b/src/interface.c
index d531929..f58b2a4 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1749,6 +1749,23 @@ int sdl_poll(void)
{
player[0] = (int)(player[0])|0x04; //Jump command
}
+
+ if(event.key.keysym.sym == SDLK_d)
+ {
+ player2[0] = (int)(player2[0])|0x02; //Go right command
+ }
+ if(event.key.keysym.sym == SDLK_a)
+ {
+ player2[0] = (int)(player2[0])|0x01; //Go left command
+ }
+ if(event.key.keysym.sym == SDLK_s && ((int)(player2[0])&0x08)!=0x08)
+ {
+ player2[0] = (int)(player2[0])|0x08; //Go left command
+ }
+ if(event.key.keysym.sym == SDLK_w && ((int)(player2[0])&0x04)!=0x04)
+ {
+ player2[0] = (int)(player2[0])|0x04; //Jump command
+ }
break;
case SDL_KEYUP:
@@ -1769,6 +1786,20 @@ int sdl_poll(void)
{
player[0] = (int)(player[0])&7;
}
+
+ if(event.key.keysym.sym == SDLK_d || event.key.keysym.sym == SDLK_a)
+ {
+ player2[1] = player2[0]; //Saving last movement
+ player2[0] = (int)(player2[0])&12; //Stop command
+ }
+ if(event.key.keysym.sym == SDLK_w)
+ {
+ player2[0] = (int)(player2[0])&11;
+ }
+ if(event.key.keysym.sym == SDLK_s)
+ {
+ player2[0] = (int)(player2[0])&7;
+ }
break;
case SDL_MOUSEBUTTONDOWN:
if(event.button.button == SDL_BUTTON_WHEELUP)