Author Topic: Infinite Pong The Movie X11  (Read 2661 times)

B+

  • Guest
Infinite Pong The Movie X11
« on: October 09, 2018, 08:10:17 pm »
Woohoo! Edit in Notepad++, drag and drop onto xbasic, get results, page through pdf manual... repeat

Code: [Select]
'xpong.bas for X11 B+ 2018-10-09 try to get running again
titlew 1, "Infinite Pong, the Movie"
p1y = 2
p2y = 378
bx = 320
by = 200
br = 8
bdx = 8
bdy = 5
red = color_rgb(1, 0, 0)
blue = color_rgb(0, 0, 1)
white = color_rgb(1, 1, 1)
black = color_rgb(0, 0, 0)
while k$ <> "q"
    ! q to quit, doesn't work!
    k$ = inkey$

    color black ! cls doesn't work so black box
    pbox 0, 0, 640, 400
   
    ! top paddle red
    p1x = bx - 50
    color red
    pbox p1x, p1y, p1x + 100, p1y + 20

    ! bottom paddle blue
    p2x = bx - 50
    color blue
    pbox p2x, p2y, p2x + 100, p2y + 20
   
    'ball handler
    If bx + bdx < 9
        bdx = bdx * -1 + Int(Rnd * 3) - 1
    endif
    if bx + bdx > 631
        bdx = bdx * -1 + Int(Rnd * 3) - 1
    endif
    if by + bdy < 30
        bdy = bdy * -1
        bdx = bdx + Int(Rnd * 3) - 1
    endif
    if by + bdy > 370
        bdy = bdy * -1
        bdx = bdx + Int(Rnd * 3) - 1
    endif
   
    'update ball
    bx = bx + bdx
    if bx < 9
        bx = 9 + Rnd
    endif
    by = by + bdy
    color white
    pcircle bx, by, br
    showpage
    pause 1/60
wend
end

Well I learned there is separate print method for graphics screen TEXT x, y, Text$, is there also one for keypresses?
« Last Edit: October 09, 2018, 08:26:59 pm by B+ »