Permainan Segitiga Berwarna
Deskripsi
Segitiga berwarna merupakan sebuah permainan sederhana yang mempunyai 6 inputan yaitu A,S,D,J,K,L di mana masing-masing inputan memiliki warna yang berbeda. untuk mendapatkan nilai cukup menekan tombol yang sesuai dan dengan posisi node yang sama yang akan melewati nya.
- A merupakan sebuah segitiga berwarna yang akan bergerak menuju kebawah ke titik node point tombol. Warna dan spawn point sesuai dengan node point segitiga
- B merupakan sebuah text yang berisikan nilai ketika seorang pemain berhasil menekan tombol yang sesuai dengan benar
- C merupakan batas waktu bagi pemain untuk mendapatkan nilai tertinggi
- D merupakan sebuah statement dimana ketika pemain berhasil menekan dengan benar dan tepat maka statement kena akan tertampil
- E merupakan node point segitiga. Di mulai dari sebelah kiri hingga kanan . 1-6 node 1=A=warna ungu , 2=S=warna birumuda , 3=D=warna kuning, 4=J=warna biru, 5=K=warna hijau, 6=L=warna merah.
FlowChart
Pembuatan node point segitiga dan warna
posisi segitiga bisa bergerak seakan turun
Posisi munculnya segitiga dan warna
Nilai/Score
Implementasi Program pada basic4gl
TextMode (TEXT_OVERLAID)
dim putar#,cx#,cy#,pelurux#,soal#,turun#,hitung#,stat,benarsalah$,nilai#,statkena,waktu#
turun#=15
hitung#=0
waktu#=60
stat=true
while true
glclear(GL_DEPTH_BUFFER_BIT OR GL_COLOR_BUFFER_BIT)
glLoadIdentity ()
glTranslatef (0,0,-20)
locate 7, 20: print "A"
locate 12, 20: print "S"
locate 17, 20: print "D"
locate 22, 20: print "J"
locate 27, 20: print "K"
locate 32, 20: print "L"
'locate 12,12: print turun#
'locate 15,15: print soal#
'status text
locate 1,1: print "Nilai " + nilai#
locate 25,1: print "Waktu " + waktu#
'status text
'status text
if statkena then
if waktu#>1 then
benarsalah$="kena"
:endif
else
benarsalah$="...."
:endif
locate 18,12: print benarsalah$
'status text
if stat=true then
hitung#=hitung#+0.1
'block translate node
if hitung#<200 data-blogger-escaped-:endif="" data-blogger-escaped-hitung="" data-blogger-escaped-if="" data-blogger-escaped-then="" data-blogger-escaped-turun="">200 then
hitung#=0
turun#=15
statkena=false
soal#=rnd()%7
:endif
'block tanslate node
:endif
if waktu#<=1 then
stat=false
statkena=true
benarsalah$=" Tekan Space \nuntuk main lagi.."
:endif
if waktu#>1 then
waktu#=waktu#-0.001
:endif
'block node
gltranslated (-10,-5,0)
glColor3f (1, 0, 1)
gosub plan
gltranslatef (4,0,0)
glColor3f (0, 1, 1)
gosub plan
gltranslatef (4,0,0)
glColor3f (1, 1, 0)
gosub plan
gltranslatef (4,0,0)
glColor3f (0, 0, 1)
gosub plan
gltranslatef (4,0,0)
glColor3f (0, 1, 0)
gosub plan
gltranslatef (4,0,0)
glColor3f (1, 0, 0)
gosub plan
'block node
'block node
if soal#=1 then
gltranslatef (-20,turun#,0)
glColor3f (1, 0, 1)
:endif
if soal#=2 then
gltranslatef (-16,turun#,0)
glColor3f (0, 1, 1)
:endif
if soal#=3 then
gltranslatef (-12,turun#,0)
glColor3f (1, 1, 0)
:endif
if soal#=4 then
gltranslatef (-8,turun#,0)
glColor3f (0, 0, 1)
:endif
if soal#=5 then
gltranslatef (-4,turun#,0)
glColor3f (0, 1, 0)
:endif
if soal#=6 then
gltranslatef (0,turun#,0)
glColor3f (1, 0, 0)
:endif
gosub plan
'block node
'block input
DrawText()
swapBuffers()
while SyncTimer (100)
if KeyDown ("A") then
if soal#=1 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if KeyDown ("S") then
if soal#=2 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if KeyDown ("D") then
if soal#=3 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if KeyDown ("J") then
if soal#=4 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if KeyDown ("K") then
if soal#=5 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if KeyDown ("L") then
if soal#=6 then
if turun#<0 data-blogger-escaped-and="" data-blogger-escaped-turun="">-5 then
nilai#=nilai#+25
statkena=true
:endif
:endif
:endif
if ScanKeyDown (VK_Space) then
if stat=false then
stat=true
statkena=false
nilai#=0
waktu#=60
:endif
:endif
wend
'block input
wend
peluru:
glBegin(GL_QUADS)
glVertex2f( -1, 1)
glVertex2f(-1,-1)
glVertex2f(1,-1)
glVertex2f(1,1)
glEnd()
return
plan:
glBegin(GL_TRIANGLES)
glVertex2f( 0, 1)
glVertex2f(-1,-1)
glVertex2f(1,-1)
glEnd()
return
Hasil Implementasi Program :
Sumber: http://andresatriaa.blogspot.com/2014/07/final-project-3d-dan-animasi.html









Tidak ada komentar:
Posting Komentar