i figured this out already sorry people
hi every one im new to the forums
im making a breakout clone but every time i run it, it draws the pong constantly, i only wanted to draw it once
can some one give me a remedy
here's the code
;breakout attempt 1
;set screen width and height
Const gwidth=640
Const gheight=520
;set graphics mode
Graphics gwidth,gheight,16,2
;set the timer to run at 30 frames per second
timer=CreateTimer(30)
;toogle auto middle handle
AutoMidHandle True
;pong image
Global img_pong=LoadImage("C:\Program Files\blitzbasic\sprites/pong.bmp")
Global img_ball=LoadImage("C:\Program Files\blitzbasic\sprites/ball.bmp")
;pong type
Type pong
Field x,y
End Type
;set starting coords
Global x=0
Global y=0
;number of pongs on the screen
Global nump=1
;set starting points
Global points=0
;set the radius(not gonna use this yet)
radius=0
;set wich area the ground will be on the map(not gonna use this yet)
ground=0
;set ball speed(not gonna use this yet)
bspeed=0
;declare pong type as "GLOBAL"
Global p.pong
;set drawing buffer to the backbuffer
SetBuffer BackBuffer()
;main loop
While Not KeyDown(1)
Cls
;create a pong
createpong(nump)
For p.pong=Each pong
;draw pong image to the screen with its coords
DrawImage img_pong,p\x,p\y
;update pongs coords
If KeyDown(205) Then p\x=p\x+5
If KeyDown(203) Then p\x=p\x-5
Next
WaitTimer(timer)
Flip
Wend
End
;create pong function
Function createpong(nump)
p.pong=New pong
p\x=400
p\y=200
End Function
|