
-----------------------------------
xHoly-Divinity
Sat Nov 04, 2006 4:11 pm

Turing Made Joystick
-----------------------------------
Someone should use this and see if they could make a game with it, that would be pretty sweet  :D . Ok, so the code probably could have been a bit shorter, but I LIKE IT!!! 8-) 


setscreen ("offscreenonly")
var x, y : int := 200
var q, r : int := 400
r := 200
var num : int := 1
drawfillbox (q, r, q + 100, r + 100, black)
drawfillbox (100, 100, 300, 300, grey)
proc draw
    drawfilloval (x, y, 30, 30, 12)
end draw
proc erase
    drawfilloval (x, y, 30, 30, white)
end erase
loop
    drawline (200, 200, x, y, white)
    drawfillbox (100, 100, 300, 300, grey)
    var a, b, press : int
    mousewhere (a, b, press)
    draw
    if whatdotcolor (a, b) = 12 and press = 1 then
        loop
            mousewhere (a, b, press)
            x := a
            y := b
            if x + 30 > 300 then
                x := 300 - 30
            end if
            if x - 30 < 100 then
                x := 100 + 30
            end if
            if y + 30 > 300 then
                y := 300 - 30
            end if
            if y - 30 < 100 then
                y := 100 + 30
            end if
            cls
            if press = 1 then
                q += round ((x - 200) / 1.5)
                r += round ((y - 200) / 1.5)
                if q < 0 then
                    q := 0
                end if
                if q + 100 > maxx then
                    q := maxx - 100
                end if
                if r < 0 then
                    r := 0
                end if
                if r + 100 > maxy then
                    r := maxy - 100
                end if
            end if
            delay (100)
            drawfillbox (q, r, q + 100, r + 100, black)
            drawfillbox (100, 100, 300, 300, grey)
            drawline (200, 200, x, y, black)
            draw
            View.Update
            if press not= 1 then
                erase
                drawfillbox (100, 100, 300, 300, grey)
                drawline (200, 200, x, y, white)
                x := 200
                y := 200
                exit
            end if
        end loop
    end if
    drawline (200, 200, x, y, white)
    draw
    View.Update
end loop


-----------------------------------
ericfourfour
Sat Nov 04, 2006 4:14 pm


-----------------------------------
Turing already has a joystick library and it is really easy to use (If i remember correctly). It just isn't documented. It will work with controllers, and possibly steering wheels.

-----------------------------------
xHoly-Divinity
Sat Nov 04, 2006 4:24 pm


-----------------------------------
This isn't a real joystick/wheel (duh!), run the program, it's an interfacable joystick on the output screen :)

-----------------------------------
NikG
Sun Nov 05, 2006 1:03 am


-----------------------------------
That's not bad!
Why don't YOU trying making a game out of it.

-----------------------------------
xHoly-Divinity
Sun Nov 05, 2006 12:19 pm


-----------------------------------
Why don't YOU trying making a game out of it.

Im experimenting on a few other ideas. There are also a few time constraints. This way, ne1 with a bit of extra time could fool around with the code and see what they can do :)

-----------------------------------
Dannyd534
Mon Nov 13, 2006 7:11 pm


-----------------------------------
alright...this is cool but do u think there is any way to hook this program through a printer port to like an RC car and make it move when u move the joystick on this program???

-----------------------------------
[Gandalf]
Tue Nov 14, 2006 12:08 am


-----------------------------------
I'm sure it is, through the parallel port, but it's up to you to figure out how.

-----------------------------------
Dannyd534
Tue Nov 14, 2006 10:31 pm


-----------------------------------
ugh parallel port :P

-----------------------------------
Prince Pwn
Fri Nov 17, 2006 11:39 pm


-----------------------------------
That is a sweet joystick. My friend had to make one in grade 12 comp. engineering (a real joystick) and run it through Turing's parallelport and parallelget procedures. But that would be sweet if you did that and made your joystick move on the screen in full 360 as your joystick would ;)
