
-----------------------------------
Nitrix
Mon Jun 06, 2005 4:35 pm

Doing multiple things at once.
-----------------------------------
Problem fixed.

-----------------------------------
Cervantes
Mon Jun 06, 2005 4:57 pm


-----------------------------------
Looks like you've got the code you would use for a process, only you've switched to procedures.  Think about how this works.  You get to your main loop, clear the screen, then go into your draw_BG procedure, in which you go into an infinate loop.  Thus, nothing else will ever happen, because you're in that loop forever.
We need to change some things:

const NPC_Vgr_Interceptor_speed := 30
var Map1 : int := Pic.FileNew ("testbg.bmp")
var Vgr_Interceptor : int := Pic.FileNew ("Vaygr_Interceptor.bmp")
var Y : int := 510
var X : int := 320
var offset : int := 0
var scroller : int := 0
setscreen ("graphics:nocursor:640;500")

loop

    scroller -= 10

    randint (offset, -20, 20)
    X := X + offset
    Y := Y - NPC_Vgr_Interceptor_speed

    cls
    Pic.Draw (Map1, 0, scroller, picCopy)
    Pic.Draw (Vgr_Interceptor, X, Y, picMerge)
    View.Update
    delay (50)
end loop

I got rid of the procedures because they were essentially one line of code each, or at least they should have been.  You had drawing procedures, and yet the code in them was to do things like adjust the position of the objects and View.Update.  That's not drawing.

-----------------------------------
[Gandalf]
Mon Jun 06, 2005 5:46 pm


-----------------------------------
I see you are using your ship name, and possibly the actual ship from Homeworld :)

If you don't already know them, you should read up on the difference between procedures and process'.

-----------------------------------
Nitrix
Mon Jun 06, 2005 5:47 pm


-----------------------------------
I took out the cls(big flickers) at the end of the program and it everything ran nicely. However for things like shooting,collision detection, and key input will still be procedures? or will they just be coded into the loop?

Oh and yes, I am using ships from Homeworld 2  :) .

-----------------------------------
Cervantes
Mon Jun 06, 2005 8:56 pm


-----------------------------------
Whether you use procedures or not is up to you.  I find them to be a nice way to add organization to your program; even if you don't use any parameters with them, I find them to be useful.  Really though, it's up to you.  :)
