Computer Science Canada

ScreenMovement in my game

Author:  poly [ Thu May 20, 2004 8:55 am ]
Post subject:  ScreenMovement in my game

Okay I am working on my final ISU and am running into a little problem here. I have a control program (RUN THIS.t), I have a guy class (guycl.tu) and I have a level01 class (level01.tu). I will explain what each of these classes is suppose to do and than I will explain what I am having trouble on.

The GUYCL.TU class controls the guy movement, redraws his new location after receiving input from user. It also controls the shooting for him

The LEVEL01.TU object controls the level. It draws the level out and handles the screen movement. When the user goes near the edge of the screen the screenMovement procedure should check to make sure it is suppose to scroll and than it scrolls, but its not doing that. I am having trouble passing the variables (guyx and guyy cord which I use to redraw the image of guys new location) from the guycl.tu into the control program than to the level01.tu and in the screenMovement to move the map.

I don't know if I have made this clear enough what I am having trouble with. Please ask for more details if you don't understand what i am trying to say, cause Im finding it tricky to explain it a bit. I did have all this working with the screenmovement and everything working and than I put everything in classes and objects and I am kind of lost on my problem. Right now I am uploading a zip of the program so ya can take a look at it. Any help is appreciated.
thanks guys Laughing

Author:  Dan [ Thu May 20, 2004 6:08 pm ]
Post subject: 

easy way whould be to put guyx and guyy in the export line like this:

code:

export drawLevel, screenMovement, guyx, guyy



and then passing them to the other class buy adding a proc to it like so:

code:

    proc setXY (x : int, y : int)
        guyx := x
        guyy := y
    end setXY


also add setXY to the export line.

then you could do somting like:

code:

level01.setXY(guycl.guyx, guycl.guyy)


to get the values in to the other class.


: