Problems with ViewportTop

0 favourites
  • 4 posts
  • Hi, I'm trying to reverse engineer the Space Blaster example to learn how it was created. I'm having some trouble with the viewport code (i.e. testing using ViewportTop("Game")and ViewportBottom("Game")).

    I'm trying to debug the code, and when I try to set the contents of a textboxt to ViewportTop("Game"), it doesn't set it to anything. Does any one know what I'm doing wrong?

    I have attached a capx file below, and wondering if anyone can help?

    dropbox.com/s/sqegh0dcm2milel/viewport.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your textbox isn't tall enough! Make it bigger/taller.

  • Oh wow, thank you so much, that solved the problem!!

  • Could I ask a follow-up question - I'm trying to create the effect when an EnemySpawner sprite comes "onto" the screen (EnemySpawner.Y >= ViewportTop("Game")?).

    However, I'm having trouble with the for-each loop (line 14, Event Sheet 1). If I see the preceding condition (line 13) to time > 0.5, then none of the following code is called. If I set the preceding condition (line 13) to every tick, then the following conditions are all called (because ViewportTop("Game") is mysteriously set to 0).

    I have attached a capx file below, and wondering if anyone can help? Can I ask why there is a difference between time > 0.5 and every tick (I assumed that both conditions will be called multiple times?)? Secondly, is there a way to call the for-each loop multiple times so I can keep testing the condition (EnemySpawner.Y >= ViewportTop("Game") until it is true?

    dropbox.com/s/tzb61wdexjlazgh/viewport2.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)