tangbj's Recent Forum Activity

  • I am reverse engineering the space raiders demo, and trying to implement enemy spawning using invisible sprites. The condition I'm using is EnemySpawner.Y >= ViewportTop("Game"), and it is almost working.

    I just have one problem: if I have two or three EnemySpawner sprite objects along the same height, instead of all the sprite objects spawning enemies, only one object spawns and the rest disappear.

    I was wondering if anyone knows how to solve this?

    dropbox.com/s/tzb61wdexjlazgh/viewport2.capx

  • 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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • Hi, I'm new to C2, and apologize if this is a noob question. I have a series of sounds effects, and I would like to play a particular sound effect when a magic wand of particular color (sprite) is dragged onto another sprite. The magic wand sprite has an instance variable of type int that indicates which color it is, and I was wondering if it is possible to save the sound effects in an array object, then depending on which instance variable of the magic wand, play a particular sound effect?

    For instance, if I were to do this in javascript, the code would look something like below. Is there any easy way to replicate this in C2?

    var arrSounds = ['1.ogg', '2.ogg', '3.ogg'];

    objToDetectDrop.addEventListener('dragover' function(e) {

        //blah blah blah

        arrSounds[e.dataTransfer.getData('color')].play();

    });

tangbj's avatar

tangbj

Member since 7 Feb, 2014

None one is following tangbj yet!

Trophy Case

  • 10-Year Club

Progress

10/44
How to earn trophies