atheorist (atheorist) wrote,

the scrolling tutorial in clickteam's games factory 2

Design an API by imitating a GUI design success? This is based on a tutorial for games factory 2's scrolling.
  1. control-n to start a new project
  2. in workspace, click on frame 1, then in properties, click on 'virtual width', and change the default (640) to larger (6400)
  3. switch to frame editor (control-m)
  4. make a quickbackground object, something to see (alt-i, o, quick, tab, enter, click)
  5. make an active object (alt-i, o, act, tab, enter, click)
  6. give the active object the 8-direction movement (properties/movement/type/eight directions)
  7. switch to the event editor (control-e)
  8. make an always condition (alt-i, d, right-click on the special computer with a question mark, select always)
  9. right click on the intersection between always and storyboard controls (a chess knight in front of a chess board), and select scrollings/center window in frame
  10. in the dialog, pick 'relative to', click active, edit x and 7 to 0, ok
  11. test it by running it F7
If you take that tutorial, and try to render it in lua-esque syntax, you might get something like this.

require 'framework'

-- start a new project
the_game = new_game()
-- change the project default frame 1 to a larger-than-default virtual width
the_frame = the_game.frame[1]
the_frame.virtual_width = 6400
-- add something to see
table.insert(the_frame.objects, new_quickbackground{ x = 100, y = 200 })
-- make an active object
player = new_active{ x = 200, y = 300 }
-- give the active object the 8-direction movement
player.movement = EIGHT_DIRECTIONS
table.insert(the_frame.objects, player)
  new_event(ALWAYS, center_window_in_frame{relative_to = player, x = 0, y = 0})


Can I develop a framework where this syntax works? Yes, sortof - using SDLFW (which is a young libsdl-bound-to-lua thing), I made something that sortof works:

  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.