public
Created

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
require 'gosu'
require 'texplay'
class GameWindow < Gosu::Window
def initialize
super 200, 200, false
self.caption = "Scratch-off Sample"
# below we set up the image resources that we'll use for the app
# your base image that will be hidden under the grey layer
@background_image = Gosu::Image.new(self, "a.jpg", true)
# simply grey to cover our first image
@grey = Gosu::Image.new(self, "grey.jpg", true)
# small pointer or virtual coin to scratch-off the coating
@pointer = Gosu::Image.new(self, "pointer.png", true)
@pos_x = 0
@pos_y = 0
end
def update
end
def draw
@background_image.draw(0, 0, 0)
@pointer.draw(mouse_x, mouse_y, 0)
a = mouse_x
b = mouse_y
@grey.paint{
circle a+5, b+5, 10, 10, :mode => :clear, :fill => true
}
#@background_image.draw(0,0,0)
@grey.draw(0, 0, 0)
end
end
 
window = GameWindow.new
window.show

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.