[Home]Kazuhiko/GameSandBox

ec2-18-219-63-90.us-east-2.compute.amazonaws.com | ToothyWiki | Kazuhiko | RecentChanges | Login | Webcomic

Yay for something that works, even if it is all almost entirely stolen from MoonShadow/Sokoban...

[Click to play]

logic
{
 array map
      { 
        1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 2, 0, 1,
        1, 0, 0, 0, 0, 0, 0, 0, 1,
        1, 0, 0, 0, 0, 1, 0, 0, 1,
        1, 0, 0, 0, 0, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 0, 0, 1,
        1, 0, 0, 0, 0, 0, 0, 0, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1
      }
 int mapwidth { 9 }
 int mapheight { 9 }
 
 // 0 = floor
 // 1 = wall
 // 2 = player
 
 // This should be taken from the map rather than set up manually, but I don't want to do an init step at the moment.
 int location { 15 }
 
 when 
 { 
    (map[location-1] == 0)
 }
 allow
 {
    map[location-1] = map[location];
    map[location] = 0;
    location = location - 1;
 }
 label { "key_a" }

 when 
 { 
    (map[location+1] == 0)
 }
 allow
 {
    map[location+1] = map[location];
    map[location] = 0;
    location = location + 1;
 }
 label { "key_d" }

 when 
 { 
    (map[location+mapwidth] == 0)
 }
 allow
 {
    map[location+mapwidth] = map[location];
    map[location] = 0;
    location = location + mapwidth;
 }
 label { "key_s" }

 when 
 { 
    (map[location-mapwidth] == 0)
 }
 allow
 {
    map[location-mapwidth] = map[location];
    map[location] = 0;
    location = location - mapwidth;
 }
 label { "key_w" }
}

display
{
 stringtable counters
 {
  ".",
  "#",
  "@"
 }

 box
 {
  content { "Psuedo-Doom" }
 }

 newline

 for y ( 0 .. (mapheight-1) )
 {
  for x ( 0 .. (mapwidth-1) )
  {
    box
    {
      width { 1.1em }
      height { 1em }
      content { counters[ map[(y*mapwidth)+x] ] }
    }
  }
  newline
 }

 newline

 // Controls
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }
  content { "q" }
  bind_action { "key_q" }
 }
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }
  content { "w" }
  bind_action { "key_w" }
 }
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }
  content { "e" }
  bind_action { "key_e" }
 }

 newline

 box
 {
  width { 0.6em }
  height { 1em }
 }
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }
  content { "a" }
  bind_action { "key_a" }
 }
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }

  content { "s" }
  bind_action { "key_s" }
 }
 box
 {
  width { 2em }
  height { 1em }
  border { 1px solid black }
  content { "d" }
  bind_action { "key_d" }
 }

 newline

 box
 {
  content{ "WASD...  Now all we need is 3D and we'll have Quake in no time..." }
 }
}



[Recompile this page]
[Compiler error log]

ec2-18-219-63-90.us-east-2.compute.amazonaws.com | ToothyWiki | Kazuhiko | RecentChanges | Login | Webcomic
This page is read-only | View other revisions | Recently used referrers
Last edited October 8, 2005 8:52 pm (viewing revision 12, which is the newest) (diff)
Search: