samples/04_physics_and_collisions/04_box_collision/app/main.rb
def defaults
    state.tile_size               = 64
    state.gravity                 = -0.2
    state.previous_tile_size    ||= state.tile_size
    state.x                     ||= 0
    state.y                     ||= 800
    state.dy                    ||= 0
    state.dx                    ||= 0
    state.world                 ||= []
    state.world_lookup          ||= {}
    state.world_collision_rects ||= []
  end
# Sets default values for variables.
# The ||= sign means that the variable will only be set to the value following the = sign if the value has
# not already been set before. Intialization happens only in the first frame.
Sets default values for variables.
The ||= sign means that the variable will only be set to the value following the = sign if the value has
not already been set before. Intialization happens only in the first frame.
Sets default values for variables . The || = sign means that the variable will only be set to the value following the = sign if the value has not already been set before . Intialization happens only in the first frame .
def defaults
    state.tile_size               = 64
    state.gravity                 = -0.2
    state.previous_tile_size    ||= state.tile_size
    state.x                     ||= 0
    state.y                     ||= 800
    state.dy                    ||= 0
    state.dx                    ||= 0
    state.world                 ||= []
    state.world_lookup          ||= {}
    state.world_collision_rects ||= []
  end
def defaults state . tile_size = 64 state . gravity = - 0.2 state . previous_tile_size ||= state . tile_size state . x ||= 0 state . y ||= 800 state . dy ||= 0 state . dx ||= 0 state . world ||= [ ] state . world_lookup ||= { } state . world_collision_rects ||= [ ] end
Sets default values for variables.
Sets default values for variables .