Sha256: 98bba96dd518a44c7afaea73c87565876b0e45793f523b6c6af064172bca42c2

Contents?: true

Size: 437 Bytes

Versions: 82

Compression:

Stored size: 437 Bytes

Contents

# -*- coding: utf-8 -*-
require 'smalruby'

car1 = Character.new(x: 0, y: 0, costume: 'car1.png')
car2 = Character.new(x: 639, y: 0, costume: 'car2.png')

car1.on(:start) do
  loop do
    move(5)
    if reach_wall?
      turn
    end
  end
end

car1.on(:hit, car2) do
  move_back(20)
  turn
end

car2.on(:start) do
  loop do
    move(10)
    if reach_wall?
      turn
    end
  end
end

car2.on(:hit, car1) do
  move_back(20)
  turn
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
smalruby-0.1.1-x86-mingw32 samples/hit_car.rb
smalruby-0.1.1 samples/hit_car.rb
smalruby-0.1.0-x86-mingw32 samples/hit_car.rb
smalruby-0.1.0 samples/hit_car.rb
smalruby-0.0.32-x86-mingw32 samples/hit_car.rb
smalruby-0.0.32 samples/hit_car.rb
smalruby-0.0.31-x86-mingw32 samples/hit_car.rb
smalruby-0.0.31 samples/hit_car.rb
smalruby-0.0.30-x86-mingw32 samples/hit_car.rb
smalruby-0.0.30 samples/hit_car.rb
smalruby-0.0.29-x86-mingw32 samples/hit_car.rb
smalruby-0.0.29 samples/hit_car.rb
smalruby-0.0.28-x86-mingw32 samples/hit_car.rb
smalruby-0.0.28 samples/hit_car.rb
smalruby-0.0.27-x86-mingw32 samples/hit_car.rb
smalruby-0.0.27 samples/hit_car.rb
smalruby-0.0.26-x86-mingw32 samples/hit_car.rb
smalruby-0.0.26 samples/hit_car.rb
smalruby-0.0.25-x86-mingw32 samples/hit_car.rb
smalruby-0.0.25 samples/hit_car.rb