
-----------------------------------
Protosstic
Wed Jun 04, 2003 3:49 pm

Need help with Flawless background w/ animated bmp's over
-----------------------------------
Hello All. I am using Turing 4.0.1 

setscreen ("graphics:640;480,offscreenonly,nobuttonbar, nocursor, noecho")
colourback (black)
cls
var picID : int
var x, y : int
var c, ci : string
var spo : int
var chars : array char of boolean
randint (spo, 1, 12)
x := 0 + (spo * 40)
y := 1
c := "1"
process bg
    drawfillbox (1, 1, 120, 80, red)
end bg

process bgmusic
    Music.PlayFile ("bgtest.mp3")
end bgmusic
process gridline
    loop
        for count : 1 .. 15
            drawline (40 * count, 1, 40 * count, 480, white)
        end for
        for count : 1 .. 11
            drawline (1, 40 * count, 640, 40 * count, white)
        end for
    end loop
end gridline
proc jump
    for count : 1 .. 8
        if c = "1j" then
            y := y + 5
            delay (25)
        elsif c = "2j" then
            y := y - 5
            delay (25)
        elsif c = "3j" then
            x := x - 5
            delay (25)
        elsif c = "4j" then
            x := x + 5
            delay (25)
        end if
        View.Update
        cls
        delay (25)
        Pic.ScreenLoad ("frog" + c + ".bmp", x, y, picMerge)
    end for
    View.Update
    cls
    delay (25)
    fork bg
    Pic.ScreenLoad ("frog" + ci + ".bmp", x, y, picMerge)
    View.Update
end jump

fork gridline
Pic.ScreenLoad ("frog1.bmp", x, y, picMerge)
delay (1000)
fork bgmusic
loop
    fork bg
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        c := "1j"
        ci := "1"
        jump
    elsif chars (KEY_DOWN_ARROW) then
        c := "2j"
        ci := "2"
        jump
    elsif chars (KEY_LEFT_ARROW) then
        c := "3j"
        ci := "3"
        jump
    elsif chars (KEY_RIGHT_ARROW) then
        c := "4j"
        ci := "4"
        jump
    end if
end loop




I really appreciate any help, we really are hoping to do good on this game!

-----------------------------------
Tony
Wed Jun 04, 2003 4:01 pm


-----------------------------------
well turing is naturally slow, and the only way to speed up the exectuion is ether

a) calculating less values or
b) move graphics over a larger distance per turn (if applicable)

If you're using a picture as your background, you can cut it up in pieces and redraw only those that are need to be restored.

-----------------------------------
Protosstic
Wed Jun 04, 2003 4:24 pm


-----------------------------------
Alright, well Should I then be having each background piece being assigned to a section, and if the frog is in that section ,it redraws it?

-----------------------------------
Tony
Wed Jun 04, 2003 4:30 pm


-----------------------------------
yeah, basically... such as you mentioned before that there was a grid... so have each grid cell as a separate picture... this way as the frog moves from 1 cell to the next, you just have to redraw that single cell instead of the whole background, speeding up the process.

-----------------------------------
Protosstic
Wed Jun 04, 2003 4:40 pm


-----------------------------------
Alright, Yeah the grid will be gone soon, it's just there for testing purposes. Now One other thing is, in the code i posted earlier, it seems to be using all my CPU when i run it and the frog is not moving (idle). Got any idea why it's doing that?

Btw, Thanks alot for all of this!

-----------------------------------
Tony
Wed Jun 04, 2003 4:59 pm


-----------------------------------
turing is naturally slow and very bad at using resourses properly... processes might affect this as well (in a bad way)...

though I dont really know

-----------------------------------
Protosstic
Wed Jun 04, 2003 5:38 pm


-----------------------------------
Well thanks alot for all your Help Tony, Very much appreciated, hope to get this game done soon. I am right now working to assign each box a number in an array, so thanks to you my project is not on pause!!!

-----------------------------------
Protosstic
Wed Jun 04, 2003 6:02 pm


-----------------------------------
Hopefully this is okay to ask in the same thread as my other post, because it is for the same game.

I am trying to make an array variable equal to something, in my 2d array. This is going to be used to give each grid spot a specific id, so i can update each one after a move. However i am having some problem with getting it going. Not sure how to make the second dimension of the variable equal to something. Here is my code.


var bgsqr : array 1 .. 192, 1 .. 2 of int

for count : 0 .. 192 by 12

    county := county + 1
    for count2 : 1 .. 16
        bgsqr (count + count2, 1) := (count2 * 40)
        bgsqr (count + count2, 2) := (county * 40)
    end for
end for


I tried to follow the tutorial, but was having some problems understanding with 2d arrays. Thanks!

-----------------------------------
Tony
Wed Jun 04, 2003 8:00 pm


-----------------------------------
hmmm... you're doing this all wrong...


var picID:array 1..10, 1..10 of int

for row:1..10
     for column:1..10
          picID(row,column) := Pic.New(row*100-100, column*100-100,row*100,column*100)
     end for
end for


This creates an array of 10x10 grid and saves 100x100 squares, where first number is the row and second is the column of there the box is located.
