SlideShare a Scribd company logo
1 of 10
Download to read offline
Ring Documentation, Release 1.7
55.28 Flappy Bird 3000 Game
The Flappy Bird 3000 Game source code
# The Ring Standard Library
# Game Engine for 2D Games
# 2016, Mahmoud Fayed <msfclipper@yahoo.com>
oGameState = NULL
Load "gameengine.ring"
func main
oGame = New Game
while true
oGameState = New GameState
oGame {
55.28. Flappy Bird 3000 Game 522
Ring Documentation, Release 1.7
title = "Flappy Bird 3000"
sprite
{
file = "images/fbback.png"
x = 0 y=0 width=800 height = 600 scaled = true animate = false
keypress = func ogame,oself,nKey {
if nkey = key_esc or nKey = GE_AC_BACK
ogame.shutdown()
but nKey = key_space
oGameState.startplay=true
ogame.shutdown=true
ok
}
mouse = func ogame,oself,nType,aMouseList {
if nType = GE_MOUSE_UP
cFunc = oself.keypress
call cFunc(oGame,oSelf,Key_Space)
ok
}
}
text {
animate = false
size = 35
file = "fonts/pirulen.ttf"
text = "Flappy Bird 3000"
x = 150 y=50
}
text {
animate = false
size = 25
file = "fonts/pirulen.ttf"
text = "Version 1.0"
x = 280 y=100
}
text {
animate = false
size = 16
file = "fonts/pirulen.ttf"
text = "(C) 2016, Mahmoud Fayed"
x = 245 y=140
}
text {
animate = false
size = 25
file = "fonts/pirulen.ttf"
text = "To Win Get Score = 3000"
x = 150 y=270
}
text {
animate = false
size = 25
file = "fonts/pirulen.ttf"
text = "Press Space to start"
x = 190 y=470
}
text {
55.28. Flappy Bird 3000 Game 523
Ring Documentation, Release 1.7
animate = false
size = 20
file = "fonts/pirulen.ttf"
text = "Press Esc to Exit"
x = 260 y=510
}
animate {
file = "images/fbbird.png"
x = 200
y = 200
framewidth = 20
scaled = true
height = 50
width = 50
nStep = 3
transparent = true
animate = true
direction = ge_direction_random
state = func oGame,oSelf {
oSelf {
nStep--
if nStep = 0
nStep = 3
if frame < 3
frame++
else
frame=1
ok
ok
if x <= 0 x=0 ok
if y <= 0 y=0 ok
if x >= 750 x= 750 ok
if y > 550 y=550 ok
}
}
}
Sound {
file = "sound/music2.wav"
}
}
if oGameState.startplay
oGame.refresh()
playstart(oGame)
oGame.refresh()
ok
end
func playstart oGame
oGame {
FPS = 60
FixedFPS = 120
Title = "Flappy Bird 3000"
Sprite {
55.28. Flappy Bird 3000 Game 524
Ring Documentation, Release 1.7
file = "images/fbback.png"
x = 0 y=0 width=800 height = 600 scaled = true animate = false
keypress = func ogame,oself,nKey {
if nkey = key_esc or nKey = GE_AC_BACK
ogame.shutdown()
ok
}
}
Map {
blockwidth = 80
blockheight = 80
aMap = [
[0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0]
]
newmap(aMap)
aImages = ["images/fbwall.png","images/fbwallup.png",
"images/fbwalldown.png"]
state = func oGame,oSelf {
if oGameState.gameresult = false
px = oGame.aObjects[3].x
py = oGame.aObjects[3].y
oSelf {
x -= 3
if x < - 2100
x = 0
newmap(aMap)
ok
nCol = getcol(px,0)
if nCol=11 or nCol=15 or nCol=19 or nCol=23 or nCol=27
if nCol != oGameState.lastcol
oGameState.lastcol = nCol
oGameState.Score += 100
oGame { Sound {
once = true
file = "sound/sfx_point.wav"
} }
checkwin(oGame)
ok
ok
}
if oSelf.getvalue(px+40,py) != 0 or
oSelf.getvalue(px+40,py+40) != 0 or
oSelf.getvalue(px,py) != 0 or
oSelf.getvalue(px,py+40) != 0
oGameState.gameresult = true
oGame {
text {
point = 550
size = 30
nStep = 3
55.28. Flappy Bird 3000 Game 525
Ring Documentation, Release 1.7
file = "fonts/pirulen.ttf"
text = "Game Over !!!"
x = 500 y=10
state = func ogame,oself {
if oself.y >= 550
ogame.shutdown = true
ok
if oself.y = 90
ogame {
Sound {
once = true
file = "sound/sfx_die.wav"
}
}
ok
}
}
Sound {
once = true
file = "sound/sfx_hit.wav"
}
}
ok
ok
}
}
animate {
file = "images/fbbird.png"
x = 10
y = 10
framewidth = 20
scaled = true
height = 50
width = 50
nStep = 3
transparent = true
state = func oGame,oSelf {
oSelf {
nStep--
if nStep = 0
nStep = 3
if frame < 3
frame++
else
frame=1
ok
ok
}
if not oGameState.playerwin
oGameState.down --
if oGameState.down = 0
oGameState.down = 3
oself {
y += 25
if y > 550 y=550 ok
}
55.28. Flappy Bird 3000 Game 526
Ring Documentation, Release 1.7
ok
ok
}
keypress = func ogame,oself,nKey {
if oGameState.gameresult = false
oself {
if nkey = key_space
y -= 55
oGameState.down = 60
if y<=0 y=0 ok
ok
}
ok
}
mouse = func ogame,oself,nType,aMouseList {
if nType = GE_MOUSE_UP
cFunc = oself.keypress
call cFunc(oGame,oSelf,Key_Space)
ok
}
}
text {
animate = false
point = 400
size = 30
file = "fonts/pirulen.ttf"
text = "Score : " + oGameState.score
x = 500 y=10
state = func oGame,oSelf {
oSelf { text = "Score : " + oGameState.score }
}
}
}
func newmap aMap
aV = [
[1,1,3,0,0,2,1,1],
[1,3,0,0,0,2,1,1],
[1,1,1,3,0,2,1,1],
[1,1,1,3,0,0,0,0],
[0,0,0,0,2,1,1,1],
[0,0,2,1,1,1,1,1],
[0,0,0,2,1,1,1,1],
[1,1,1,3,0,2,1,1],
[1,1,1,1,1,3,0,0],
[3,0,0,2,1,1,1,1],
[3,0,0,2,3,0,0,2]
]
for x = 10 to 24 step 4
aVar = aV[ (random(10)+1) ]
for y = 1 to 8
aMap[y][x] = aVar[y]
next
next
55.28. Flappy Bird 3000 Game 527
Ring Documentation, Release 1.7
func checkwin ogame
if oGameState.score = 3000
oGameState.gameresult = true
oGameState.playerwin = true
oGame {
text {
point = 400
size = 30
nStep = 3
file = "fonts/pirulen.ttf"
text = "You Win !!!"
x = 500 y=10
state = func ogame,oself {
if oself.y >= 400
ogame.shutdown = true
oGameState.value = 0
ok
}
}
}
ok
Class GameState
down = 3
gameresult = false
Score = 0
startplay=false
lastcol = 0
playerwin = false
Screen Shot:
55.28. Flappy Bird 3000 Game 528
Ring Documentation, Release 1.7
55.29 Super Man 2016 Game
The Super Man 2016 Game source code
# The Ring Standard Library
# Game Engine for 2D Games
# 2016, Mahmoud Fayed <msfclipper@yahoo.com>
oGameState = NULL
Load "gameengine.ring"
func main
oGame = New Game
while true
oGameState = new GameState
oGame {
title = "Super Man 2016"
55.29. Super Man 2016 Game 529
Ring Documentation, Release 1.7
sprite
{
file = "images/superman.jpg"
x = 0 y=0 width=800 height = 600 scaled = true animate = false
keypress = func ogame,oself,nKey {
if nkey = key_esc or nKey = GE_AC_BACK
ogame.shutdown()
but nKey = key_space
oGameState.startplay=true
ogame.shutdown=true
ok
}
mouse = func ogame,oself,nType,aMouseList {
if nType = GE_MOUSE_UP
oGameState.startplay=true
ogame.shutdown=true
ok
}
state = func ogame,oself {
oself {
if x > -500
x-=1
y-=1
width +=1
height +=4
ok
}
}
}
text {
animate = false
size = 35
file = "fonts/pirulen.ttf"
text = "Super Man 2016"
x = 20 y=30
}
text {
animate = false
size = 25
file = "fonts/pirulen.ttf"
text = "Version 1.0"
x = 20 y=80
}
text {
animate = false
size = 16
file = "fonts/pirulen.ttf"
text = "(C) 2016, Mahmoud Fayed"
x = 20 y=120
}
text {
animate = false
size = 25
file = "fonts/pirulen.ttf"
text = "Press Space to start"
x = 190 y=470
}
55.29. Super Man 2016 Game 530
Ring Documentation, Release 1.7
text {
animate = false
size = 20
file = "fonts/pirulen.ttf"
text = "Press Esc to Exit"
x = 260 y=510
}
animate {
file = "images/superman.png"
x = 200
y = 200
framewidth = 68
scaled = true
height = 86
width = 60
nStep = 10
transparent = true
animate = true
direction = ge_direction_random
state = func oGame,oSelf {
oSelf {
nStep--
if nStep = 0
nStep = 10
if frame < 1
frame++
else
frame=1
ok
ok
if x <= 0 x=0 ok
if y <= 0 y=0 ok
if x >= 750 x= 750 ok
if y > 550 y=550 ok
}
}
}
Sound {
file = "sound/music2.wav"
}
}
if oGameState.startplay
oGame.refresh()
playstart(oGame)
oGame.refresh()
ok
end
func playstart oGame
oGame {
FPS = 60
FixedFPS = 15
Title = "Super Man 2016"
55.29. Super Man 2016 Game 531

More Related Content

What's hot

The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.3 book - Part 42 of 88The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.3 book - Part 42 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 51 of 185
The Ring programming language version 1.5.4 book - Part 51 of 185The Ring programming language version 1.5.4 book - Part 51 of 185
The Ring programming language version 1.5.4 book - Part 51 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 54 of 189
The Ring programming language version 1.6 book - Part 54 of 189The Ring programming language version 1.6 book - Part 54 of 189
The Ring programming language version 1.6 book - Part 54 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 52 of 185
The Ring programming language version 1.5.4 book - Part 52 of 185The Ring programming language version 1.5.4 book - Part 52 of 185
The Ring programming language version 1.5.4 book - Part 52 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 62 of 210
The Ring programming language version 1.9 book - Part 62 of 210The Ring programming language version 1.9 book - Part 62 of 210
The Ring programming language version 1.9 book - Part 62 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 57 of 202
The Ring programming language version 1.8 book - Part 57 of 202The Ring programming language version 1.8 book - Part 57 of 202
The Ring programming language version 1.8 book - Part 57 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 40 of 84
The Ring programming language version 1.2 book - Part 40 of 84The Ring programming language version 1.2 book - Part 40 of 84
The Ring programming language version 1.2 book - Part 40 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.5.1 book - Part 49 of 180The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.5.1 book - Part 49 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.9 book - Part 60 of 210The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.9 book - Part 60 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 62 of 212
The Ring programming language version 1.10 book - Part 62 of 212The Ring programming language version 1.10 book - Part 62 of 212
The Ring programming language version 1.10 book - Part 62 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 50 of 181
The Ring programming language version 1.5.2 book - Part 50 of 181The Ring programming language version 1.5.2 book - Part 50 of 181
The Ring programming language version 1.5.2 book - Part 50 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.4.1 book - Part 15 of 31The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.4.1 book - Part 15 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 53 of 189
The Ring programming language version 1.6 book - Part 53 of 189The Ring programming language version 1.6 book - Part 53 of 189
The Ring programming language version 1.6 book - Part 53 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5 book - Part 9 of 31The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5 book - Part 9 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 38 of 84
The Ring programming language version 1.2 book - Part 38 of 84The Ring programming language version 1.2 book - Part 38 of 84
The Ring programming language version 1.2 book - Part 38 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.5.2 book - Part 52 of 181The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.5.2 book - Part 52 of 181Mahmoud Samir Fayed
 

What's hot (20)

The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181
 
The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.3 book - Part 42 of 88The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.3 book - Part 42 of 88
 
The Ring programming language version 1.5.4 book - Part 51 of 185
The Ring programming language version 1.5.4 book - Part 51 of 185The Ring programming language version 1.5.4 book - Part 51 of 185
The Ring programming language version 1.5.4 book - Part 51 of 185
 
The Ring programming language version 1.6 book - Part 54 of 189
The Ring programming language version 1.6 book - Part 54 of 189The Ring programming language version 1.6 book - Part 54 of 189
The Ring programming language version 1.6 book - Part 54 of 189
 
The Ring programming language version 1.5.4 book - Part 52 of 185
The Ring programming language version 1.5.4 book - Part 52 of 185The Ring programming language version 1.5.4 book - Part 52 of 185
The Ring programming language version 1.5.4 book - Part 52 of 185
 
The Ring programming language version 1.9 book - Part 62 of 210
The Ring programming language version 1.9 book - Part 62 of 210The Ring programming language version 1.9 book - Part 62 of 210
The Ring programming language version 1.9 book - Part 62 of 210
 
The Ring programming language version 1.8 book - Part 57 of 202
The Ring programming language version 1.8 book - Part 57 of 202The Ring programming language version 1.8 book - Part 57 of 202
The Ring programming language version 1.8 book - Part 57 of 202
 
The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184
 
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88
 
The Ring programming language version 1.2 book - Part 40 of 84
The Ring programming language version 1.2 book - Part 40 of 84The Ring programming language version 1.2 book - Part 40 of 84
The Ring programming language version 1.2 book - Part 40 of 84
 
The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184
 
The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.5.1 book - Part 49 of 180The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.5.1 book - Part 49 of 180
 
The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.9 book - Part 60 of 210The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.9 book - Part 60 of 210
 
The Ring programming language version 1.10 book - Part 62 of 212
The Ring programming language version 1.10 book - Part 62 of 212The Ring programming language version 1.10 book - Part 62 of 212
The Ring programming language version 1.10 book - Part 62 of 212
 
The Ring programming language version 1.5.2 book - Part 50 of 181
The Ring programming language version 1.5.2 book - Part 50 of 181The Ring programming language version 1.5.2 book - Part 50 of 181
The Ring programming language version 1.5.2 book - Part 50 of 181
 
The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.4.1 book - Part 15 of 31The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.4.1 book - Part 15 of 31
 
The Ring programming language version 1.6 book - Part 53 of 189
The Ring programming language version 1.6 book - Part 53 of 189The Ring programming language version 1.6 book - Part 53 of 189
The Ring programming language version 1.6 book - Part 53 of 189
 
The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5 book - Part 9 of 31The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5 book - Part 9 of 31
 
The Ring programming language version 1.2 book - Part 38 of 84
The Ring programming language version 1.2 book - Part 38 of 84The Ring programming language version 1.2 book - Part 38 of 84
The Ring programming language version 1.2 book - Part 38 of 84
 
The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.5.2 book - Part 52 of 181The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.5.2 book - Part 52 of 181
 

Similar to The Ring programming language version 1.7 book - Part 56 of 196

The Ring programming language version 1.5.3 book - Part 60 of 184
The Ring programming language version 1.5.3 book - Part 60 of 184The Ring programming language version 1.5.3 book - Part 60 of 184
The Ring programming language version 1.5.3 book - Part 60 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.7 book - Part 55 of 196The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.7 book - Part 55 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 52 of 189
The Ring programming language version 1.6 book - Part 52 of 189The Ring programming language version 1.6 book - Part 52 of 189
The Ring programming language version 1.6 book - Part 52 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 55 of 189
The Ring programming language version 1.6 book - Part 55 of 189The Ring programming language version 1.6 book - Part 55 of 189
The Ring programming language version 1.6 book - Part 55 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 61 of 212
The Ring programming language version 1.10 book - Part 61 of 212The Ring programming language version 1.10 book - Part 61 of 212
The Ring programming language version 1.10 book - Part 61 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.7 book - Part 56 of 196 (11)

The Ring programming language version 1.5.3 book - Part 60 of 184
The Ring programming language version 1.5.3 book - Part 60 of 184The Ring programming language version 1.5.3 book - Part 60 of 184
The Ring programming language version 1.5.3 book - Part 60 of 184
 
The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.7 book - Part 55 of 196The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.7 book - Part 55 of 196
 
The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180
 
The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202
 
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185
 
The Ring programming language version 1.6 book - Part 52 of 189
The Ring programming language version 1.6 book - Part 52 of 189The Ring programming language version 1.6 book - Part 52 of 189
The Ring programming language version 1.6 book - Part 52 of 189
 
The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180
 
The Ring programming language version 1.6 book - Part 55 of 189
The Ring programming language version 1.6 book - Part 55 of 189The Ring programming language version 1.6 book - Part 55 of 189
The Ring programming language version 1.6 book - Part 55 of 189
 
The Ring programming language version 1.10 book - Part 61 of 212
The Ring programming language version 1.10 book - Part 61 of 212The Ring programming language version 1.10 book - Part 61 of 212
The Ring programming language version 1.10 book - Part 61 of 212
 
The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202
 
The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84
 

More from Mahmoud Samir Fayed

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212Mahmoud Samir Fayed
 

More from Mahmoud Samir Fayed (20)

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
 
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

The Ring programming language version 1.7 book - Part 56 of 196

  • 1. Ring Documentation, Release 1.7 55.28 Flappy Bird 3000 Game The Flappy Bird 3000 Game source code # The Ring Standard Library # Game Engine for 2D Games # 2016, Mahmoud Fayed <msfclipper@yahoo.com> oGameState = NULL Load "gameengine.ring" func main oGame = New Game while true oGameState = New GameState oGame { 55.28. Flappy Bird 3000 Game 522
  • 2. Ring Documentation, Release 1.7 title = "Flappy Bird 3000" sprite { file = "images/fbback.png" x = 0 y=0 width=800 height = 600 scaled = true animate = false keypress = func ogame,oself,nKey { if nkey = key_esc or nKey = GE_AC_BACK ogame.shutdown() but nKey = key_space oGameState.startplay=true ogame.shutdown=true ok } mouse = func ogame,oself,nType,aMouseList { if nType = GE_MOUSE_UP cFunc = oself.keypress call cFunc(oGame,oSelf,Key_Space) ok } } text { animate = false size = 35 file = "fonts/pirulen.ttf" text = "Flappy Bird 3000" x = 150 y=50 } text { animate = false size = 25 file = "fonts/pirulen.ttf" text = "Version 1.0" x = 280 y=100 } text { animate = false size = 16 file = "fonts/pirulen.ttf" text = "(C) 2016, Mahmoud Fayed" x = 245 y=140 } text { animate = false size = 25 file = "fonts/pirulen.ttf" text = "To Win Get Score = 3000" x = 150 y=270 } text { animate = false size = 25 file = "fonts/pirulen.ttf" text = "Press Space to start" x = 190 y=470 } text { 55.28. Flappy Bird 3000 Game 523
  • 3. Ring Documentation, Release 1.7 animate = false size = 20 file = "fonts/pirulen.ttf" text = "Press Esc to Exit" x = 260 y=510 } animate { file = "images/fbbird.png" x = 200 y = 200 framewidth = 20 scaled = true height = 50 width = 50 nStep = 3 transparent = true animate = true direction = ge_direction_random state = func oGame,oSelf { oSelf { nStep-- if nStep = 0 nStep = 3 if frame < 3 frame++ else frame=1 ok ok if x <= 0 x=0 ok if y <= 0 y=0 ok if x >= 750 x= 750 ok if y > 550 y=550 ok } } } Sound { file = "sound/music2.wav" } } if oGameState.startplay oGame.refresh() playstart(oGame) oGame.refresh() ok end func playstart oGame oGame { FPS = 60 FixedFPS = 120 Title = "Flappy Bird 3000" Sprite { 55.28. Flappy Bird 3000 Game 524
  • 4. Ring Documentation, Release 1.7 file = "images/fbback.png" x = 0 y=0 width=800 height = 600 scaled = true animate = false keypress = func ogame,oself,nKey { if nkey = key_esc or nKey = GE_AC_BACK ogame.shutdown() ok } } Map { blockwidth = 80 blockheight = 80 aMap = [ [0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0], [0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0], [0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0], [0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,1,0,0,0], [0,0,0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0] ] newmap(aMap) aImages = ["images/fbwall.png","images/fbwallup.png", "images/fbwalldown.png"] state = func oGame,oSelf { if oGameState.gameresult = false px = oGame.aObjects[3].x py = oGame.aObjects[3].y oSelf { x -= 3 if x < - 2100 x = 0 newmap(aMap) ok nCol = getcol(px,0) if nCol=11 or nCol=15 or nCol=19 or nCol=23 or nCol=27 if nCol != oGameState.lastcol oGameState.lastcol = nCol oGameState.Score += 100 oGame { Sound { once = true file = "sound/sfx_point.wav" } } checkwin(oGame) ok ok } if oSelf.getvalue(px+40,py) != 0 or oSelf.getvalue(px+40,py+40) != 0 or oSelf.getvalue(px,py) != 0 or oSelf.getvalue(px,py+40) != 0 oGameState.gameresult = true oGame { text { point = 550 size = 30 nStep = 3 55.28. Flappy Bird 3000 Game 525
  • 5. Ring Documentation, Release 1.7 file = "fonts/pirulen.ttf" text = "Game Over !!!" x = 500 y=10 state = func ogame,oself { if oself.y >= 550 ogame.shutdown = true ok if oself.y = 90 ogame { Sound { once = true file = "sound/sfx_die.wav" } } ok } } Sound { once = true file = "sound/sfx_hit.wav" } } ok ok } } animate { file = "images/fbbird.png" x = 10 y = 10 framewidth = 20 scaled = true height = 50 width = 50 nStep = 3 transparent = true state = func oGame,oSelf { oSelf { nStep-- if nStep = 0 nStep = 3 if frame < 3 frame++ else frame=1 ok ok } if not oGameState.playerwin oGameState.down -- if oGameState.down = 0 oGameState.down = 3 oself { y += 25 if y > 550 y=550 ok } 55.28. Flappy Bird 3000 Game 526
  • 6. Ring Documentation, Release 1.7 ok ok } keypress = func ogame,oself,nKey { if oGameState.gameresult = false oself { if nkey = key_space y -= 55 oGameState.down = 60 if y<=0 y=0 ok ok } ok } mouse = func ogame,oself,nType,aMouseList { if nType = GE_MOUSE_UP cFunc = oself.keypress call cFunc(oGame,oSelf,Key_Space) ok } } text { animate = false point = 400 size = 30 file = "fonts/pirulen.ttf" text = "Score : " + oGameState.score x = 500 y=10 state = func oGame,oSelf { oSelf { text = "Score : " + oGameState.score } } } } func newmap aMap aV = [ [1,1,3,0,0,2,1,1], [1,3,0,0,0,2,1,1], [1,1,1,3,0,2,1,1], [1,1,1,3,0,0,0,0], [0,0,0,0,2,1,1,1], [0,0,2,1,1,1,1,1], [0,0,0,2,1,1,1,1], [1,1,1,3,0,2,1,1], [1,1,1,1,1,3,0,0], [3,0,0,2,1,1,1,1], [3,0,0,2,3,0,0,2] ] for x = 10 to 24 step 4 aVar = aV[ (random(10)+1) ] for y = 1 to 8 aMap[y][x] = aVar[y] next next 55.28. Flappy Bird 3000 Game 527
  • 7. Ring Documentation, Release 1.7 func checkwin ogame if oGameState.score = 3000 oGameState.gameresult = true oGameState.playerwin = true oGame { text { point = 400 size = 30 nStep = 3 file = "fonts/pirulen.ttf" text = "You Win !!!" x = 500 y=10 state = func ogame,oself { if oself.y >= 400 ogame.shutdown = true oGameState.value = 0 ok } } } ok Class GameState down = 3 gameresult = false Score = 0 startplay=false lastcol = 0 playerwin = false Screen Shot: 55.28. Flappy Bird 3000 Game 528
  • 8. Ring Documentation, Release 1.7 55.29 Super Man 2016 Game The Super Man 2016 Game source code # The Ring Standard Library # Game Engine for 2D Games # 2016, Mahmoud Fayed <msfclipper@yahoo.com> oGameState = NULL Load "gameengine.ring" func main oGame = New Game while true oGameState = new GameState oGame { title = "Super Man 2016" 55.29. Super Man 2016 Game 529
  • 9. Ring Documentation, Release 1.7 sprite { file = "images/superman.jpg" x = 0 y=0 width=800 height = 600 scaled = true animate = false keypress = func ogame,oself,nKey { if nkey = key_esc or nKey = GE_AC_BACK ogame.shutdown() but nKey = key_space oGameState.startplay=true ogame.shutdown=true ok } mouse = func ogame,oself,nType,aMouseList { if nType = GE_MOUSE_UP oGameState.startplay=true ogame.shutdown=true ok } state = func ogame,oself { oself { if x > -500 x-=1 y-=1 width +=1 height +=4 ok } } } text { animate = false size = 35 file = "fonts/pirulen.ttf" text = "Super Man 2016" x = 20 y=30 } text { animate = false size = 25 file = "fonts/pirulen.ttf" text = "Version 1.0" x = 20 y=80 } text { animate = false size = 16 file = "fonts/pirulen.ttf" text = "(C) 2016, Mahmoud Fayed" x = 20 y=120 } text { animate = false size = 25 file = "fonts/pirulen.ttf" text = "Press Space to start" x = 190 y=470 } 55.29. Super Man 2016 Game 530
  • 10. Ring Documentation, Release 1.7 text { animate = false size = 20 file = "fonts/pirulen.ttf" text = "Press Esc to Exit" x = 260 y=510 } animate { file = "images/superman.png" x = 200 y = 200 framewidth = 68 scaled = true height = 86 width = 60 nStep = 10 transparent = true animate = true direction = ge_direction_random state = func oGame,oSelf { oSelf { nStep-- if nStep = 0 nStep = 10 if frame < 1 frame++ else frame=1 ok ok if x <= 0 x=0 ok if y <= 0 y=0 ok if x >= 750 x= 750 ok if y > 550 y=550 ok } } } Sound { file = "sound/music2.wav" } } if oGameState.startplay oGame.refresh() playstart(oGame) oGame.refresh() ok end func playstart oGame oGame { FPS = 60 FixedFPS = 15 Title = "Super Man 2016" 55.29. Super Man 2016 Game 531