Sha256: cdd0cae0304ae09bd974dd1db52a5c4094813a488411161c7ecced1b3cdd254c

Contents?: true

Size: 431 Bytes

Versions: 4

Compression:

Stored size: 431 Bytes

Contents

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

car1 = Character.new(x: 0, y: 0, costume: 'car1.png')
car1.rotation_style = :free

car1.on(:start) do
  loop do
    move(15)
    turn_if_reach_wall
  end
end

car1.on(:click) do
  rotate(15)
end

car1.on(:key_push, K_1) do
  self.rotation_style = :free
end

car1.on(:key_push, K_2) do
  self.rotation_style = :left_right
end

car1.on(:key_push, K_3) do
  self.rotation_style = :none
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smalruby-0.0.20-x86-mingw32 samples/car.rb
smalruby-0.0.20 samples/car.rb
smalruby-0.0.19-x86-mingw32 samples/car.rb
smalruby-0.0.19 samples/car.rb