Setelah tahu kegunaan function POINT, kita akan mencoba untuk menerapkan dalam program animasi si Marle. Kendala awal yang ditemui adalah ukuran sprite Marle yang terdiri dari 6 sprite dalam sekali gerakan, atau sekali tombol arrow key ditekan, dan kebetulan ukuran sprite tersebut berbeda-beda. Ini yang menjadi masalah baru, soalnya di dalam map kita nantinya, gambar yang kita buat bisa jadi tidak beraturan. Dan karena kita tidak menggunakan tile map seperti yang biasa digunakan dalam kebanyakan game2 RPG yang dibuat pake QBasic, maka kita harus menemukan solusinya. Seperti yang sudah kita ketahui bahwa metode POINT akan membandingkan warna pixel yang ada di dekat sprite. Dan warna ideal yang dibandingkan tentunya adalah 0 / hitam. Ini artinya jika kita menggunakan metode POINT, warna background harus hitam, atau serupa. Soalnya deteksi tubrukan antara sprite dengan background lainnya, akan membandingkan warna, jika warna yang dideteksi dengan fungsi POINT masih menunjukkan hitam, artinya sprite masih boleh jalan, tetapi jika menemukan warna lain, maka sprite harus berhenti karena tubrukan terdeteksi.
Biasanya kita akan mengambil titik tengah dari suatu sprite yang digunakan untuk pedoman pembacaan fungsi POINT. Akan tetapi untuk sprite2 dengan ukuran yang cukup besar, seperti sprite Marle, pembacaan dari titik tengah seperti ini tidak menghasilkan hasil yang akurat. Untuk itu perlu dipikirkan cara mengatasi hal ini. Akhirnya kita dapat mencoba untuk mengambil tiga buah titik atas, tengah dan bawah, dimana pengecekannya nanti akan kita gabung dengan operator AND, sehingga dihasilkan hasil yang cukup akurat.

IF POINT((marler1(0) / 8) + x.pos + cek.selisih, y.pos) <= 0 AND POINT((marler1(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler1(0) / 8) + x.pos + cek.selisih, marler1(1) + y.pos) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF

Di dalam pengecekan POINT, kita perlu mengambil elemen indeks pertama dan kedua ( 0 dan 1) dari sprite. Kenapa??? Karena elemen ke – 0 dari array menyimpan nilai lebar sprite setelah dibagi dengan 8 (tidak perlu pake fungsi INT lagi, karena sudah pasti habis dibagi 8) , sedangkan elemen ke -1 menyimpan nilai tinggi dari sprite. Variabel cek.selisih akan diisi sebelum masuk dalam looping utama dengan nilai integer, variabel ini adalah selisih jarak antara titik POINT dengan warna pixel yang dibandingkan. Terus dibawahnya kita perlu cek lagi, apakah sprite Marle sudah di batas layar, kalo sudah artinya kita akan munculkan sprite di posisi baru yang berlawanan, agar tidak muncul ERROR.
Oya mengenai pengecekan dengan metode POINT ini, kita harus meletakkan setiap instruksi di atas pada setiap gerakan sprite. Mungkin ini nantinya yang akan memboroskan memory. Tapi hasil yang kita dapatkan dari instruksi ini cukup akurat dan memuaskan.
Kemudian kita bisa memasukkan beberapa object pohon sebagai bahan percobaan dari animasi Marle dan hasilnya Marle akan berhenti pada saat dia “menubruk” pohon. Dan karena kita sudah masukkan pengecekan POINT untuk setiap gerakan sprite, maka pada gerakan yang manapun, Marle akan tetap berhenti pada saat menjumpai pohon. Berikut ini adalah listing program lengkapnya…

’Marle with Collission Detection using POINT

CLEAR
DEFINT A-Z

CONST Path$ = “”

OPEN “tree.shp” FOR INPUT AS #1
DIM SHARED tree(222): FOR i = 0 TO 222: INPUT #1, tree(i): NEXT: CLOSE #1

‘Kumpulan Gambar Marle bergerak ke kanan
‘15 x 32
OPEN Path$ + “Marler.shp” FOR INPUT AS #1
DIM SHARED marler(266): FOR i = 0 TO 266: INPUT #1, marler(i): NEXT: CLOSE #1
‘17 x 32
OPEN Path$ + “Marler1.shp” FOR INPUT AS #1
DIM SHARED marler1(299): FOR i = 0 TO 299: INPUT #1, marler1(i): NEXT: CLOSE #1
‘18 x 30
OPEN Path$ + “Marler2.shp” FOR INPUT AS #1
DIM SHARED marler2(296): FOR i = 0 TO 296: INPUT #1, marler2(i): NEXT: CLOSE #1
‘18 x 32
OPEN Path$ + “Marler3.shp” FOR INPUT AS #1
DIM SHARED marler3(315): FOR i = 0 TO 315: INPUT #1, marler3(i): NEXT: CLOSE #1
‘17 x 32
OPEN Path$ + “Marler4.shp” FOR INPUT AS #1
DIM SHARED marler4(299): FOR i = 0 TO 299: INPUT #1, marler4(i): NEXT: CLOSE #1
‘18 x 31
OPEN Path$ + “Marler5.shp” FOR INPUT AS #1
DIM SHARED marler5(306): FOR i = 0 TO 306: INPUT #1, marler5(i): NEXT: CLOSE #1
‘19 x 32
OPEN Path$ + “Marler6.shp” FOR INPUT AS #1
DIM SHARED marler6(332): FOR i = 0 TO 332: INPUT #1, marler6(i): NEXT: CLOSE #1

‘Kumpulan Gambar Marle bergerak ke kiri
‘15 x 32
OPEN Path$ + “Marlel.shp” FOR INPUT AS #1
DIM SHARED marlel(266): FOR i = 0 TO 266: INPUT #1, marlel(i): NEXT: CLOSE #1
‘17 x 32
OPEN Path$ + “Marlel1.shp” FOR INPUT AS #1
DIM SHARED marlel1(299): FOR i = 0 TO 299: INPUT #1, marlel1(i): NEXT: CLOSE #1
‘18 x 30
OPEN Path$ + “Marlel2.shp” FOR INPUT AS #1
DIM SHARED marlel2(296): FOR i = 0 TO 296: INPUT #1, marlel2(i): NEXT: CLOSE #1
‘18 x 32
OPEN Path$ + “Marlel3.shp” FOR INPUT AS #1
DIM SHARED marlel3(315): FOR i = 0 TO 315: INPUT #1, marlel3(i): NEXT: CLOSE #1
‘17 x 32
OPEN Path$ + “Marlel4.shp” FOR INPUT AS #1
DIM SHARED marlel4(299): FOR i = 0 TO 299: INPUT #1, marlel4(i): NEXT: CLOSE #1
‘18 x 31
OPEN Path$ + “Marlel5.shp” FOR INPUT AS #1
DIM SHARED marlel5(306): FOR i = 0 TO 306: INPUT #1, marlel5(i): NEXT: CLOSE #1
‘19 x 32
OPEN Path$ + “Marlel6.shp” FOR INPUT AS #1
DIM SHARED marlel6(332): FOR i = 0 TO 332: INPUT #1, marlel6(i): NEXT: CLOSE #1

‘Kumpulan Gambar Marle bergerak ke bawah
‘13 x 33
OPEN Path$ + “Marled.shp” FOR INPUT AS #1
DIM SHARED marled(240): FOR i = 0 TO 240: INPUT #1, marled(i): NEXT: CLOSE #1
‘14 x 33
OPEN Path$ + “Marled1.shp” FOR INPUT AS #1
DIM SHARED marled1(257): FOR i = 0 TO 257: INPUT #1, marled1(i): NEXT: CLOSE #1
‘15 x 35
OPEN Path$ + “Marled2.shp” FOR INPUT AS #1
DIM SHARED marled2(290): FOR i = 0 TO 290: INPUT #1, marled2(i): NEXT: CLOSE #1
‘15 x 35
OPEN Path$ + “Marled3.shp” FOR INPUT AS #1
DIM SHARED marled3(290): FOR i = 0 TO 290: INPUT #1, marled3(i): NEXT: CLOSE #1
‘14 x 35
OPEN Path$ + “Marled4.shp” FOR INPUT AS #1
DIM SHARED marled4(257): FOR i = 0 TO 257: INPUT #1, marled4(i): NEXT: CLOSE #1
‘16 x 35
OPEN Path$ + “Marled5.shp” FOR INPUT AS #1
DIM SHARED marled5(308): FOR i = 0 TO 308: INPUT #1, marled5(i): NEXT: CLOSE #1
‘15 x 35
OPEN Path$ + “Marled6.shp” FOR INPUT AS #1
DIM SHARED marled6(290): FOR i = 0 TO 290: INPUT #1, marled6(i): NEXT: CLOSE #1

‘Kumpulan Gambar Marle bergerak ke atas
‘12 x 32
OPEN Path$ + “Marleu.shp” FOR INPUT AS #1
DIM SHARED marleu(216): FOR i = 0 TO 216: INPUT #1, marleu(i): NEXT: CLOSE #1
‘13 x 32
OPEN Path$ + “Marleu1.shp” FOR INPUT AS #1
DIM SHARED marleu1(233): FOR i = 0 TO 233: INPUT #1, marleu1(i): NEXT: CLOSE #1
‘16 x 33
OPEN Path$ + “Marleu2.shp” FOR INPUT AS #1
DIM SHARED marleu2(291): FOR i = 0 TO 291: INPUT #1, marleu2(i): NEXT: CLOSE #1
‘14 x 33
OPEN Path$ + “Marleu3.shp” FOR INPUT AS #1
DIM SHARED marleu3(257): FOR i = 0 TO 257: INPUT #1, marleu3(i): NEXT: CLOSE #1
‘13 x 32
OPEN Path$ + “Marleu4.shp” FOR INPUT AS #1
DIM SHARED marleu4(233): FOR i = 0 TO 233: INPUT #1, marleu4(i): NEXT: CLOSE #1
‘16 x 33
OPEN Path$ + “Marleu5.shp” FOR INPUT AS #1
DIM SHARED marleu5(291): FOR i = 0 TO 291: INPUT #1, marleu5(i): NEXT: CLOSE #1
‘14 x 33
OPEN Path$ + “Marleu6.shp” FOR INPUT AS #1
DIM SHARED marleu6(257): FOR i = 0 TO 257: INPUT #1, marleu6(i): NEXT: CLOSE #1

PRINT “Free array space : “; FRE(-1)
t$ = INPUT$(1)

SCREEN 13
CLS

‘Animasi berjalan
x.pos = 10: y.pos = 30
x.old = x.pos: y.old = y.pos
x.ofset = 4: y.ofset = 4
‘variabel posisi digunakan untuk mengecek posisi terakhir sprite
posisi = 1
‘variabel waktu tunda untuk animasi Marle berjalan
delay = 1700
bataskanan = 295
bataskiri = 10
batasbawah = 160
batasatas = 10
cek.selisih = 5
center.selisih = 5

GOSUB Gb1
PUT (x.pos, y.pos), marler

main:
x.center = x.pos + 10
y.center = y.pos + 15
a$ = INKEY$
IF a$ = “” THEN GOTO main
IF LEN(a$) <> 2 THEN GOSUB not.arrow
keyb = ASC(RIGHT$(a$, 1))
IF keyb = 72 THEN GOSUB atas
IF keyb = 75 THEN GOSUB kiri
IF keyb = 77 THEN GOSUB kanan
IF keyb = 80 THEN GOSUB bawah
‘clean the keyboard buffer before go back to main loop
DEF SEG = &H40
POKE &H1A, PEEK(&H1C)
GOTO main

kanan:
‘hapus spritenya
‘cek posisi terakhir sprite menghadap kemana???
oldx.pos = x.pos: oldy.pos = y.pos
SELECT CASE posisi
CASE 1 ‘kanan
PUT (oldx.pos, oldy.pos), marler
CASE 2 ‘kiri
PUT (oldx.pos, oldy.pos), marlel
CASE 3 ‘bawah
PUT (oldx.pos, oldy.pos), marled
CASE 4 ‘atas
PUT (oldx.pos, oldy.pos), marleu
END SELECT
IF POINT((marler1(0) / 8) + x.pos + cek.selisih, y.pos) <= 0 AND POINT((marler1(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler1(0) / 8) + x.pos + cek.selisih, marler1(1) + y.pos) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler1
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler1
IF POINT((marler2(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler2(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler2(0) / 8) + x.pos + cek.selisih, marler2(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler2
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler2
IF POINT((marler3(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler3(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler3(0) / 8) + x.pos + cek.selisih, marler3(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler3
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler3
IF POINT((marler4(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler4(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler4(0) / 8) + x.pos + cek.selisih, marler4(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler4
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler4
IF POINT((marler5(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler5(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler5(0) / 8) + x.pos + cek.selisih, marler5(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler5
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler5
IF POINT((marler6(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler6(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler6(0) / 8) + x.pos + cek.selisih, marler6(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler6
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marler6
IF POINT((marler(0) / 8) + x.pos + cek.selisih, y.pos + center.selisih) <= 0 AND POINT((marler(0) / 8) + x.pos + cek.selisih, y.center) <= 0 AND POINT((marler(0) / 8) + x.pos + cek.selisih, marler(1) + y.pos – center.selisih) <= 0 THEN
IF x.pos <= bataskanan THEN
x.pos = x.pos + x.ofset
ELSE
x.pos = bataskiri
END IF
ELSE
PUT (x.pos, y.pos), marler
posisi = 1
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marler
‘jangan lupa untuk mengeset variabel posisi
posisi = 1
RETURN

kiri:
‘hapus spritenya
‘cek posisi terakhir sprite menghadap kemana???
oldx.pos = x.pos: oldy.pos = y.pos
SELECT CASE posisi
CASE 1 ‘kanan
PUT (oldx.pos, oldy.pos), marler
CASE 2 ‘kiri
PUT (oldx.pos, oldy.pos), marlel
CASE 3 ‘bawah
PUT (oldx.pos, oldy.pos), marled
CASE 4 ‘atas
PUT (oldx.pos, oldy.pos), marleu
END SELECT
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel1(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel1
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel1
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel2(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel2
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel2
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel3(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel3
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel3
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel4(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel4
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel4
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel5(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel5
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel5
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel6(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel6
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marlel6
IF POINT(x.pos – cek.selisih, y.pos) <= 0 AND POINT(x.pos – cek.selisih, y.center) <= 0 AND POINT(x.pos – cek.selisih, marlel(1) + y.pos) <= 0 THEN
IF x.pos >= bataskiri THEN
x.pos = x.pos – x.ofset
ELSE
x.pos = bataskanan
END IF
ELSE
PUT (x.pos, y.pos), marlel
posisi = 2
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marlel
‘jangan lupa untuk mengeset variabel posisi
posisi = 2
RETURN

bawah:
‘hapus spritenya
‘cek posisi terakhir sprite menghadap kemana???
oldx.pos = x.pos: oldy.pos = y.pos
SELECT CASE posisi
CASE 1 ‘kanan
PUT (oldx.pos, oldy.pos), marler
CASE 2 ‘kiri
PUT (oldx.pos, oldy.pos), marlel
CASE 3 ‘bawah
PUT (oldx.pos, oldy.pos), marled
CASE 4 ‘atas
PUT (oldx.pos, oldy.pos), marleu
END SELECT
IF POINT(x.pos, marled1(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled1(1) + y.pos + cek.selisih) <= 0 AND POINT((marled1(0) / 8) + x.pos, marled1(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled1
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled1
IF POINT(x.pos, marled2(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled2(1) + y.pos + cek.selisih) <= 0 AND POINT((marled2(0) / 8) + x.pos, marled2(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled2
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled2
IF POINT(x.pos, marled3(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled3(1) + y.pos + cek.selisih) <= 0 AND POINT((marled3(0) / 8) + x.pos, marled3(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled3
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled3
IF POINT(x.pos, marled4(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled4(1) + y.pos + cek.selisih) <= 0 AND POINT((marled4(0) / 8) + x.pos, marled4(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled4
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled4
IF POINT(x.pos, marled5(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled5(1) + y.pos + cek.selisih) <= 0 AND POINT((marled5(0) / 8) + x.pos, marled5(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled5
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled5
IF POINT(x.pos, marled6(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled6(1) + y.pos + cek.selisih) <= 0 AND POINT((marled6(0) / 8) + x.pos, marled6(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled6
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marled6
IF POINT(x.pos, marled(1) + y.pos + cek.selisih) <= 0 AND POINT(x.center, marled(1) + y.pos + cek.selisih) <= 0 AND POINT((marled(0) / 8) + x.pos, marled(1) + y.pos + cek.selisih) <= 0 THEN
IF y.pos <= batasbawah THEN
y.pos = y.pos + y.ofset
ELSE
y.pos = batasatas
END IF
ELSE
PUT (x.pos, y.pos), marled
posisi = 3
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marled
‘jangan lupa untuk mengeset variabel posisi
posisi = 3
RETURN

atas:
‘hapus spritenya
‘cek posisi terakhir sprite menghadap kemana???
oldx.pos = x.pos: oldy.pos = y.pos
SELECT CASE posisi
CASE 1 ‘kanan
PUT (oldx.pos, oldy.pos), marler
CASE 2 ‘kiri
PUT (oldx.pos, oldy.pos), marlel
CASE 3 ‘bawah
PUT (oldx.pos, oldy.pos), marled
CASE 4 ‘atas
PUT (oldx.pos, oldy.pos), marleu
END SELECT
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu1(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu1
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu1
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu2(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu2
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu2
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu3(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu3
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu3
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu4(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu4
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu4
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu5(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu5
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu5
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu6(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu6
FOR z = 1 TO delay: FOR y = 1 TO delay: NEXT: NEXT
‘hapus spritenya
oldx.pos = x.pos: oldy.pos = y.pos
PUT (oldx.pos, oldy.pos), marleu6
IF POINT(x.pos, y.pos – cek.selisih) <= 0 AND POINT(x.center, y.pos – cek.selisih) <= 0 AND POINT((marleu(0) / 8) + x.pos, y.pos – cek.selisih) <= 0 THEN
IF y.pos >= batasatas THEN
y.pos = y.pos – y.ofset
ELSE
y.pos = batasbawah
END IF
ELSE
PUT (x.pos, y.pos), marleu
posisi = 4
RETURN
END IF
‘letakkan di posisi baru
PUT (x.pos, y.pos), marleu
‘jangan lupa untuk mengeset variabel posisi
posisi = 4
RETURN

Gb1:
LINE (0, 0)-(319, 199), 0, BF
FOR i = 3 TO 13
PUT (0 + i * 18, 143), tree
PUT (0 + i * 18, 162), tree
PUT (0 + i * 18, 10), tree
NEXT
FOR i = 0 TO 4
PUT (200 + i * 18, 67), tree
PUT (200 + i * 18, 86), tree
NEXT
FOR i = 0 TO 3
PUT (164 + i * 18, 29), tree
PUT (164 + i * 18, 48), tree
NEXT
PUT (290, 86), tree
PUT (290, 105), tree
PUT (290, 124), tree
PUT (0, 105), tree
PUT (0, 124), tree
PUT (0, 86), tree
PUT (18, 86), tree
PUT (36, 86), tree
PUT (54, 86), tree
PUT (72, 86), tree
PUT (90, 86), tree
PUT (108, 86), tree
PUT (126, 86), tree
RETURN

not.arrow:
‘Jika ditekan tombol q maka program akan berhenti
IF a$ = “q” THEN
WIDTH 80
SCREEN 0
COLOR 7, 0
CLS
END
END IF
RETURN

oya, mapnya masih digambar manual, yaitu meletakkan object2nya secara manual dengan PUT, untuk lebih bagusnya kita bisa pakai metode BSAVE untuk menyimpan gambar seluruh layar dan kalau diperlukan tinggal di BLOAD saja.