Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var h1e = h1edpi_module
- var FPS = 30
- var TICK_LENGTH = 1000/FPS
- var SCREEN_W = 240
- var SCREEN_H = 160
- h1e.bgstyle = "#000000"
- h1e.init($("#main_canvas")[0], SCREEN_W, SCREEN_H, FPS)
- //h1e.add_image("game", "game.png")
- //h1e.def_sprite("ship", "game"+m, [[0,0,16,16]])
- function Game(){
- this.tick = function(h1e){
- }
- }
- function GameSection(game){
- game = game ? game : new Game()
- this.draw = function(h1e){
- }
- this.trigger_end = function(won){
- }
- this.event = function(h1e, event){
- if(event.type == "keydown"){
- if(h1e.iskey(event.key, ["escape", "q"])){
- //h1e.remove_section(this)
- return true
- }
- }
- }
- this.update = function(h1e){
- if(h1e.keydown("left"))
- console.log("left")
- if(h1e.keydown("right"))
- console.log("right")
- game.tick()
- return true
- }
- }
- h1e.push_section(new GameSection())
- function pad_stuff(){
- h1e.resize_canvas($(window).width() - 5, $(window).height() - 5)
- }
- $(document).ready(function(){
- pad_stuff()
- $(window).resize(function(){
- pad_stuff()
- })
- h1e.start()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement