File tree Expand file tree Collapse file tree 8 files changed +56
-7
lines changed
Expand file tree Collapse file tree 8 files changed +56
-7
lines changed Original file line number Diff line number Diff line change 11# Example Game
22
3- Barebones example game for Yeah
3+ Barebones example game for Yeah, a work in progress
44
55## Usage
66
Original file line number Diff line number Diff line change 1- class ExampleGame < Yeah ::Game
2- def initialize
3- super
1+ require 'spaces/world' #
42
5- puts "Hello!"
6- display . size = 320 , 240
7- end
3+ class Example < Yeah ::Game
4+ #class Example < Game
5+ display . size = 320 , 240
6+ self . space = World
87end
Original file line number Diff line number Diff line change 1+ require 'yeah/fill_look' #
2+
3+ class CloudLook < Yeah ::FillLook #
4+ #class CloudLook < FillLook
5+ self . size = 120 , 20
6+ self . color = 0.8 , 0.8 , 0.9
7+ end
Original file line number Diff line number Diff line change 1+ require 'yeah/image_look' #
2+
3+ class DuckLook < Yeah ::ImageLook #
4+ #class DuckLook < ImageLook
5+ self . image = "duck.jpg" #
6+ end
Original file line number Diff line number Diff line change 1+ require 'things/duck' #
2+ require 'things/cloud' #
3+
4+ class World < Yeah ::Space #
5+ #class World < Space
6+ self . size = 320 , 240
7+ self . clear_color = 0.5 , 0.7 , 0.5
8+
9+ def initialize
10+ super
11+
12+ things << Cloud . new ( x : width * 0.6 , y : height * 0.8 )
13+ things << Duck . new ( x : width / 2 , y : height / 2 )
14+ #things << Duck.new(position: Vec2.divide(size, 2))
15+ end
16+ end
Original file line number Diff line number Diff line change 1+ require 'looks/cloud_look' #
2+
3+ class Cloud < Yeah ::Thing #
4+ #class Cloud < Thing
5+ self . look = CloudLook #
6+
7+ def act ( input , space )
8+ self . x -= 1
9+ end
10+ end
Original file line number Diff line number Diff line change 1+ require 'yeah/thing' #
2+ require 'looks/duck_look' #
3+
4+ class Duck < Yeah ::Thing #
5+ #class Duck < Thing
6+ self . look = DuckLook #
7+
8+ def act ( input , space )
9+ puts "Quack" if rand > 0.8
10+ end
11+ end
You can’t perform that action at this time.
0 commit comments