PDA

View Full Version : Ball Train



peter
07-12-2013, 00:03
Hi,

I do not think there is interest. Is infant school technique.


#INCLUDE "a.inc"
OpenWindow 640,480,0 'FullScreen isn't supported in several Graphics Card, then make use of 1 for Windowed.


Long fo, i
fo = LoadBmp "bmp/char.bmp",60


Type cBall
x As Long
y As Long
d As Long
End Type


Dim ball(4) As cBall
ball(1).x=40 : ball(1).y=40
ball(2).x=80 : ball(2).y=40
ball(3).x=120: ball(3).y=40
ball(4).x=160: ball(4).y=40
ball(1).d=1
ball(2).d=1
ball(3).d=1
ball(4).d=1


While KeyDown(27)=0
ClearScr 0
BmpText fo,0, 0, "!!!!!!!!!!!!!!!!",40,40
BmpText fo,0, 40,"!##############!",40,40
BmpText fo,0, 80,"!##############!",40,40
BmpText fo,0,120,"!##############!",40,40
BmpText fo,0,160,"!##############!",40,40
BmpText fo,0,200,"!##############!",40,40
BmpText fo,0,240,"!##############!",40,40
BmpText fo,0,280,"!##############!",40,40
BmpText fo,0,320,"!##############!",40,40
BmpText fo,0,360,"!##############!",40,40
BmpText fo,0,400,"!##############!",40,40
BmpText fo,0,440,"!!!!!!!!!!!!!!!!",40,40


BmpText fo,ball(4).x,ball(4).y,"$",40,40
BmpText fo,ball(3).x,ball(3).y,"%",40,40
BmpText fo,ball(2).x,ball(2).y,"&",40,40
BmpText fo,ball(1).x,ball(1).y,"'",40,40

BmpText fo,0, 0, "!!!!!!!!!!!!!!!!",40,40
BmpText fo,0, 40,"!((((((((((((((!",40,40
BmpText fo,0, 80,"!(############(!",40,40
BmpText fo,0,120,"!(############(!",40,40
BmpText fo,0,160,"!(############(!",40,40
BmpText fo,0,200,"!(############(!",40,40
BmpText fo,0,240,"!(############(!",40,40
BmpText fo,0,280,"!(############(!",40,40
BmpText fo,0,320,"!(############(!",40,40
BmpText fo,0,360,"!(############(!",40,40
BmpText fo,0,400,"!((((((((((((((!",40,40
BmpText fo,0,440,"!!!!!!!!!!!!!!!!",40,40


BmpText fo,95,220,"HELLO MAP",50,60


For i=1 To 4
If ball(i).d=1 Then
If ball(i).x <560 Then
ball(i).x +=1
Else
ball(i).d=2
PlayWav "wave/plop.wav"
End If
End If
Next

For i=1 To 4
If ball(i).d=2 Then
If ball(i).y <400 Then
ball(i).y +=1
Else
ball(i).d=3
PlayWav "wave/plop.wav"
End If
End If
Next


For i=1 To 4
If ball(i).d=3 Then
If ball(i).x >40 Then
ball(i).x -=1
Else
ball(i).d=4
PlayWav "wave/plop.wav"
End If
End If
Next


For i=1 To 4
If ball(i).d=4 Then
If ball(i).y >40 Then
ball(i).y -=1
Else
ball(i).d=1
PlayWav "wave/plop.wav"
End If
End If
Next


Events
FlipBuffer
SetFps(160)
Wend
CloseWindow

mike lobanovsky
07-12-2013, 13:43
Runs smooth for me and looks quite nice. Do not despair. :)

peter
07-12-2013, 13:53
Thanks Mike.

Do not despair

LOL and LOL