a
http://andrewschultz.com/wp-content/uploads/2012/10/fun_heart_blue.jpghttps://www.flickr.com/photos/isriya/7180133440/in/photolist-bWu4w9-bWu2FL-bWu41J-bWu34N-bWu3BE-bWu3du-bWu2eu-bWu3PG-bWu4fC-bWu23w-6TqHos-5ZU29M-6m71g-6m7cG-6GPYhV-6m7nP-6m7g2-6m76Y-6m7aD-dnN9WN-6m7jB-6m749-dz56wz-dzaHgN-
Slide 17
Slide 17 text
Alright, lets code a
game in …
Slide 18
Slide 18 text
C++ or C#
http://andrewschultz.com/wp-content/uploads/2012/10/fun_heart_blue.jpg
Slide 19
Slide 19 text
Build a game +
in RUBY
http://www.weddingchicks.com/wp-content/uploads/2014/04/best-day-ever-entrance-550x366.jpg
Slide 20
Slide 20 text
GOSU
• 2D Game Development Library.
• Originally written in C++ by Julian Raschke and
Jan Lucker.
• Official Website: http://www.libgosu.org
• Official game board: http://www.libgosu.org/cgi-
bin/mwf/board_show.pl?bid=2
Slide 21
Slide 21 text
GOSU Showcase
Slide 22
Slide 22 text
pop-the-balloon /
carfight
Slide 23
Slide 23 text
DragonEggs
Slide 24
Slide 24 text
No content
Slide 25
Slide 25 text
Captain Ruby
Slide 26
Slide 26 text
Game Development
Considerations:
• Story
• Design (look and feel)
• Gameplay
Slide 27
Slide 27 text
Game Development
Concepts
GAMELOOP
Slide 28
Slide 28 text
The only concept..!!!
INITIALIZE
DRAW
UPDATE
Slide 29
Slide 29 text
Basic Gosu Methods
• initialize!
• draw!
• update
Slide 30
Slide 30 text
Components of
DragonEggs
• Game Window
• Eggs
• Baskets
• Collision + Game logic
• Asthetics
Multiple Eggs
#initialize the eggs array!
@eggs = []!
!
!
#set the starting positions of eggs!
@config[‘eggs’][‘count'].times do |d|!
@eggs << Egg.new(self, 400*d + 400, 100)!
end!
instance of Game Window
Slide 41
Slide 41 text
0 x-axis 800
800 y-axis 0!
Slide 42
Slide 42 text
Draw Eggs
def draw!
@eggs.each(&:draw)!
end!
Slide 43
Slide 43 text
Move Eggs
def update_next_egg_position(position)!
!
#the egg has fallen, so increase fall count by 1!
@fall_count += 1 !
!
#egg should move -400 to be visible at the screen!
current_egg.x = current_egg.x - (400 * @fall_count)!
!
end
Slide 44
Slide 44 text
Drop Egg
!
!
def update_current_egg(egg)!
egg.y = egg.y + @config['game']['gravity'] if egg.free_fall!
!
#when pressed space, current egg should fall!
if button_down?(Gosu::KbSpace)!
egg.free_fall!!
#to move the curret egg left only when it is not free fall!
elsif button_down?(Gosu::KbLeft) && !egg.free_fall!
egg.x = egg.x - 10 if egg.x > 100!
elsif button_down?(Gosu::KbRight) && !egg.free_fall!
egg.x = egg.x + 10 if egg.x < 700!
end!
end