

-----------------------------------

Zeppelin

Tue May 20, 2008 12:52 pm


Shooting Mechanic Help

-----------------------------------

I'm making a little overhead GTA clone to refresh my Turing skills. I started with the shooting mechanic but i already have two problems. 1) Is it possible to use a multi button mouse and a keyboard at the same time in Turing and 2) How can i make it so that bullets land anywhere within the area of a circle.

Here's the code I have so far. I just started so please ignore the unused variables.

setscreen ("graphics: 800;600")
View.Set ("offscreenonly")

drawfillbox (300, 100, 315, 150, black)

drawfillbox (300, 300, 315, 350, red)

var Weapon : string
var CoAx, CoAy, EnemyHP, FireMode, SemiAuto, Semi, Burst, Auto : int
var x, y, button : int
var chars : array char of boolean

Weapon := "AK-74"
Semi := 1
Burst := 0
Auto := 1
FireMode := 3
SemiAuto := 0
EnemyHP := 100
CoAx := 25
CoAy := 25
Mouse.ButtonChoose ("multibutton")

loop
    cls
    Mouse.Where (x, y, button)
    Text.Locate (1, 1)
    if FireMode = 1 then
        put "Semi"
    elsif FireMode = 2 then
        put "Burst"
    elsif FireMode = 3 then
        put "Auto"
    end if
    drawfillbox (300, 100, 315, 150, black)
    drawfillbox (300, 300, 315, 350, red)
    drawoval (x, y, CoAx, CoAy, black)
    drawfilloval (x, y, 2, 2, black)
    View.Update
    if CoAx > 25 and CoAy > 25 then
        CoAx := CoAx - 1
        CoAy := CoAx
    elsif CoAx < 25 and CoAy < 25 then
        CoAx := CoAx + 1
        CoAy := CoAx
    end if
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if FireMode = 1 and Burst = 1 then
            FireMode := 2
        elsif FireMode = 1 and Burst = 0 and Auto = 1 then
            FireMode := 3
        elsif FireMode = 2 and Auto = 1 then
            FireMode := 3
        elsif FireMode = 2 and Auto = 0 then
            FireMode := 1
        elsif FireMode = 3 then
            FireMode := 1
        end if
    end if
    if button = 1 then
        CoAx := CoAx + 4
        CoAy := CoAx
        if CoAx > 65 then
            CoAx := 65
            CoAy := 65
        end if
    elsif button = 100 and CoAx 