Sha256: bb725e6886d9e6155dc0686c9c009e105a8e411be520ce1e3d81d7b3521a1215

Contents?: true

Size: 777 Bytes

Versions: 44

Compression:

Stored size: 777 Bytes

Contents

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

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

car1.on(:start) do
  loop do
    if enable_pen
      say(message: 'ペンを下げる')
    else
      say(message: 'ペンを上げる')
    end
  end
end

car1.on(:click) do
  if enable_pen
    up_pen
  else
    down_pen
  end
end

car1.on(:key_push, K_1) do
  self.pen_color = 'red'
end

car1.on(:key_push, K_2) do
  self.pen_color = 'blue'
end

car1.on(:key_push, K_3) do
  self.pen_color = 'green'
end

car1.on(:key_push, K_4) do
  self.pen_color = 'black'
end

car1.on(:key_down, K_LEFT) do
  rotate(-15)
end

car1.on(:key_down, K_RIGHT) do
  rotate(15)
end

car1.on(:key_down, K_UP) do
  move(30)
end

car1.on(:key_down, K_DOWN) do
  move(-30)
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
smalruby-0.1.11-x86-mingw32 samples/pen2.rb
smalruby-0.1.11 samples/pen2.rb
smalruby-0.1.10-x86-mingw32 samples/pen2.rb
smalruby-0.1.10 samples/pen2.rb
smalruby-0.1.9-x86-mingw32 samples/pen2.rb
smalruby-0.1.9 samples/pen2.rb
smalruby-0.1.8-x86-mingw32 samples/pen2.rb
smalruby-0.1.8 samples/pen2.rb
smalruby-0.1.7-x86-mingw32 samples/pen2.rb
smalruby-0.1.7 samples/pen2.rb
smalruby-0.1.6-x86-mingw32 samples/pen2.rb
smalruby-0.1.6 samples/pen2.rb
smalruby-0.1.5-x86-mingw32 samples/pen2.rb
smalruby-0.1.5 samples/pen2.rb
smalruby-0.1.4-x86-mingw32 samples/pen2.rb
smalruby-0.1.4 samples/pen2.rb
smalruby-0.1.3-x86-mingw32 samples/pen2.rb
smalruby-0.1.3 samples/pen2.rb
smalruby-0.1.2-x86-mingw32 samples/pen2.rb
smalruby-0.1.2 samples/pen2.rb