Computer Science Canada

Running Processes With the Main Program

Author:  Dragon20942 [ Fri Jan 21, 2011 9:42 pm ]
Post subject:  Running Processes With the Main Program

Turing:

procedure shipHitProc
    for j : 0 .. howManyEnemies
        for k : 0 .. 19
            if hitbox (1) >= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox (1) <= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75 - (waves (i).enemyBulletCenteringPixelX (j) +
                    37)) * 2))
                    or hitbox (3) >= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox (3) <= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75
                    - (waves (i).enemyBulletCenteringPixelX (j) + 37)) * 2))
                    or hitbox (1) <= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox (3) >= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75
                    - (waves (i).enemyBulletCenteringPixelX (j) + 37)) * 2)) then

                if hitbox (2) >= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox (2) <= (waves (i).enemyBulletsY (j).enemyBulletsY (k) + (waves (i).enemyBulletCenteringPixelY (j)
                        * (-1)))
                        or hitbox (4) >= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox (4) <= (waves (i).enemyBulletsY (j).enemyBulletsY (k)
                        + (waves (i).enemyBulletCenteringPixelY (j) * (-1)))
                        or hitbox (2) <= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox (4) >= (waves (i).enemyBulletsY (j).enemyBulletsY (k)
                        + (waves (i).enemyBulletCenteringPixelY (j) * (-1))) then
                    ifHit := true
                end if
            end if
        end for
    end for
    for j : 0 .. howManyEnemies
        for k : 0 .. 19
            if hitbox2 (1) >= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox2 (1) <= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75 - (waves (i).enemyBulletCenteringPixelX (j) +
                    37)) * 2))
                    or hitbox2 (3) >= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox2 (3) <= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75
                    - (waves (i).enemyBulletCenteringPixelX (j) + 37)) * 2))
                    or hitbox2 (1) <= waves (i).enemyBulletsX (j).enemyBulletsX (k) and hitbox2 (3) >= (waves (i).enemyBulletsX (j).enemyBulletsX (k) + ((75
                    - (waves (i).enemyBulletCenteringPixelX (j) + 37)) * 2)) then

                if hitbox2 (2) >= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox2 (2) <= (waves (i).enemyBulletsY (j).enemyBulletsY (k) + (waves (i).enemyBulletCenteringPixelY (j)
                        * (-1)))
                        or hitbox2 (4) >= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox2 (4) <= (waves (i).enemyBulletsY (j).enemyBulletsY (k)
                        + (waves (i).enemyBulletCenteringPixelY (j) * (-1)))
                        or hitbox2 (2) <= waves (i).enemyBulletsY (j).enemyBulletsY (k) and hitbox2 (4) >= (waves (i).enemyBulletsY (j).enemyBulletsY (k)
                        + (waves (i).enemyBulletCenteringPixelY (j) * (-1))) then
                    ifHit := true
                end if
            end if
        end for
    end for

    if ifHit = true then
        lives -= 1
        shipStyle := shipHit
        %resume main program
       delay (1000)
       shipStyle := shipRegular
    end if
end shipHitProc


ignore the big, fancy, inefficient if statments and focus on the shipStyles. Could I run this procedure, and after a certain point, run the main program with it? I want to use the delay to keep shipStyle as shipHit WHILE THE PROGRAM IS RUNNING before changing it back to shipRegular.

Author:  Insectoid [ Fri Jan 21, 2011 10:00 pm ]
Post subject:  RE:Running Processes With the Main Program

Use a counter. after X frames/seconds since last, change the image back to normal.

Author:  RandomLetters [ Fri Jan 21, 2011 10:03 pm ]
Post subject:  RE:Running Processes With the Main Program

I do not believe it is possible.

You can however, try the Time.Elapsed function.

Author:  Dragon20942 [ Fri Jan 21, 2011 10:09 pm ]
Post subject:  RE:Running Processes With the Main Program

How would I do since X seconds?

Author:  Insectoid [ Fri Jan 21, 2011 10:31 pm ]
Post subject:  RE:Running Processes With the Main Program

Time.DelaySinceLast().


: