Problem: need solving. Camera control.

giacomopoppigiacomopoppi Member, PRO Posts: 914
edited November -1 in Working with GS (Mac)
hi ive got my game here:
http://gamesalad.com/game/play/37009
what i need help with:
when i create a tower of blocks and it falls the camera view doesnt go down with the blocks.
i need a sort of rule saying that when there are no more actor "blocks" in the Camìera view move down speed 150.
how do i do this, or something similar?

Comments

  • dereklaruedereklarue Member Posts: 121
    Try something like, giving the last block created the camera view.
    Might be your best bet.
    :o
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    its a bit hard to do that because every click you do you spawn a block so even if one fell off the camera would fall even though the tower is still up.
    try the game and you will notice. the aim of the game is to get the highest tower of blocks you can.
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    anyone know the answer to this?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I would try having an invisible actor that controls the camera.

    you would need to keep track of the height of the tower globally, and constrain the Y position of the invisible actor to the global game.towerHeight...

    Something like this...

    A global game attribute (real) called towerHeight

    Every block would need something like this:

    In the block actor, add two boolean attributes called:
    isOnTower
    hasAddedToTowerHeight

    Add a rule that says:

    Rule
    ALL
    When self.Position.Y > 0
    When self.Position.X > 0
    When self.Position.X < game.sceneWidth
    Change Attribute: self. isOnTower to TRUE
    Otherwise
    Change Attribute: self. isOnTower to FALSE

    Another rule that says:

    ALL
    When self. isOnTower is TRUE
    When self. hasAddedToTowerHeight is FALSE
    Change Attribute: game. towerHeight = game. towerHeight + self.Height;
    Change Attribute:self. hasAddedToTowerHeight to TRUE

    And another rule that says:

    ALL
    When self. isOnTower is FALSE
    When self. hasAddedToTowerHeight is TRUE
    Change Attribute: game. towerHeight = game. towerHeight - self.Height;
    Change Attribute:self. hasAddedToTowerHeight to FALSE

    In the invisible Camera Controller:

    Constrain Attribute
    self.Position.Y To: game.TowerHeight

    Control Camera

    That SHOULD do the trick...
    Just off the top of my head...

    Hope this helps!

    Joe
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    thx so much, ill try it now :)
Sign In or Register to comment.