4.2T gosu cycle example.docx - require'gosu require\/circle module ZOrder BACKGROUND MIDDLE TOP =*0.2 end Instructions Add a shape_x variable in the

4.2T gosu cycle example.docx - require'gosu require/circle...

This preview shows page 1 - 3 out of 3 pages.

require 'gosu'require './circle'module ZOrderBACKGROUND, MIDDLE, TOP = *0..2end# Instructions:# Add a shape_x variable in the following (similar to the cycle one)# that is initialised to zero then incremented by 10 in update.# Change the draw method to draw a shape (circle or square)# (50 pixels in width and height) with a y coordinate of 30# and an x coordinate of shape_x.class GameWindow < Gosu::Window# initialize creates a window with a width an a height# and a caption. It also sets up any variables to be used.# This is procedure i.e the return value is 'undefined'def initializesuper 200, 135, falseself.caption = "Gosu Cycle Example"@shape_x = 0# Create and load an image to display@background_image = Gosu::Image.new("media/earth.png")# Create and load a font for drawing text on the screen@font = Gosu::Font.new(20)@cycle = 0puts "0. In initialize\n"end
# Put any work you want done in update

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture