Progress


Ok, I have a compiler working. Here is my test program again, with some minor modifications to allow the villain to track the hero. I needed to add this so I could work on objects being able to access each other's data.


(Import Engine)
(Game
  (Levels 
    (level1
      (background image:"background.png" x:0 y:350)
      (hero image:"GoodGuy.png" x:0 y:0 physics:true
        {
          (tick
            (if (Input KeyD) (inc self.x 5))
            (if (Input KeyA) (dec self.x 5)))
        }
      )
      (villain image:"BadGuy.png" physics:true x:100 y:100 
        {
          (tick
            (if (gt parent.hero.x self.x) (inc self.x 1))
            (if (lt parent.hero.x self.x) (dec self.x 1)))
        }
      )
    )
  )
)

The compiler can read this into an IR, re-organize it and write it out as javascript. The functions in the game language above can call out into my game engine. I could make this write out C and raylib instead easy enough, but web games are easier to work with.

You can see the mostly useless demo on the main page https://traviswalton.itch.io/cubesacrifice and press D and A to move the hero and watch the villain follow. So far the whole thing looks more or less as predicted:

That's it for today. Tomorrow I need to hook in collision detection, some physics and maybe tile maps.  This will require a bunch of new language features and a lot of work in the engine. 

Leave a comment

Log in with itch.io to leave a comment.