Visual Coding

Objects and Instances

  • An object is a self-contained unit that contains both data (properties) and functionality (methods)

    • Objects represent "things" that your program manipulates

  • An instance is a specific realization of an object

    • Each instance has its own unique state (property values)

  • Layoutobject can multiple instances

  • There visible and invisible objects

  • Practice:

    • Visible objects. Create new instances of sprite object

    • Invisible object. Add keyboard controls

Events

  • An event is a signal that something has happened, such as a button click, page load, or data arrival

  • Common User Interface Events: click, mousedown, mouseup, mousemove, keydown, keyup

  • FYI, custom events can be created but thats beyond scope of this class

  • Two parts. Condition and the action.

  • Practice

    • Add default behaviors for 8D movement

    • Assign keyboard events

      • on Key is down-> Simulate control -> direction

      • add OR block

Event: On Start of layout

  • On start of layout an event that fires automatically once when a layout is first loaded

  • Each layout has its own independent "On start of layout" event

  • Practice

    • Condition: `System-> On start of layout

    • Action: Create object-> select layer -> set position

    • Randomize position

Last updated