Tomycase's Recent Forum Activity

  • Sure, if you can locate the problematic event, send me a screenshot and I'll take a look;

    Did you try the cannons method?

  • You're talking about the issue I had with HTML elements right? That would explain the problem then, thanks

  • Did you make sure that the turrets lasers got destroyed at some point? Otherwise it will create more and more objects on your layout, give it the "Destroy outside layout" behavior, or destroy the lazer if not on-screen by events

    My take on your cannons : i.ibb.co/jwdHjbJ/Example3.gif

    The code:

    I used a "On start of Layout" trigger but you can use whatever trigger you want (a function for example) to setup the cannon's laser; I gave a boolean variable to the laser sprite "Active" that I toggle on/off with a function (so it doesn't rely on a loop);

    When "Laser" function triggers, if laser boolean is false, it will turn it true and change its visibility/collision enabled, and the opposite if true on "Laser" trigger; be sure that boolean is true before running the events, otherwise it won't work as intended;

    Edit : I think your slowdown comes from a loop somewhere in your events, I'd need to look at your project capx if only you agree ofc, but that way I can check what is going wrong

  • It works perfectly fine now, thanks ~

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not because I didn't answered that I didn't see it, I'm not always available, get my own stuff to do too, anyway;

    I'll be looking at your lazer code today, did you test what I sent yesterday for your turrets?

    (also there is an edit button if you need to add something to your post instead of reposting one)

  • Em, what the message spam is for exactly?

  • Okay so, here is what I did for your turret, what I get : i.ibb.co/b7jnDn1/Example2.gif

    How I achieved it :

    I reused the loopindex trick this time to determine which image point to use on the turret (loopindex+1, otherwise it would pick points 0 and 1 instead of 1 and 2)

    For the turret itself I just copy pasted it on the layout and changed the angle of the second one to 180, then I pass the angle to the laser within the event, if laser bullet parameter "set angle" is on, it will automatically change the angle of the sprite without extra actions;

    For your second image I'd need a description of what effect you want to achieve here, because I'm not sure to get it, and also your lasers ray behaviors and parameters;

  • No problem! Also try to do as I recommended for your objects that behave the same, your cannons and turrets for example, that will save memory and code ^^

  • Perfect! Here is the example then :

    This is the result I get : i.ibb.co/h7MFhfn/Example.gif

    3 enemies, I destroy them and the face appears gradually with the forcefield;

    This is how I achieved it :

    What I did, is to put all the enemies in a common family, and give a variable named "Activation" to the computer face sprite;

    When a sprite from the enemy family is destroyed, it adds 1 to "Activation"; When this variable reachs the number of enemy you want, it triggers that event once :

    "Wait 1 second > Repeat 4 times : Wait loopindex*(time you want) > opacity+25

    Loopindex represents the index of the current loop, in this event when it repeats 4 times, the first loop index = 0, second loop = 1, third loop = 2; etc (index always starts from 0 unless you use a "For" loop)

    The 4 loops trigger at the same time, but the wait action delay is equal to the loop index multiplied by the number of your choice, which means in the example that the first opacity adjustement triggers at 0*0.5 = 0s, second at 1*0.5 = 0.5s, third at 2*0.5 = 1s, etc;

    That way you have events that rely only on triggers instead of a loops with the result you wanted ^^

    Be careful however if you use that loopindex method to not use it into a looping condition, otherwise it will repeat constantly, it needs to be triggered a single time (with a trigger event or "trigger once while true);

    Btw unrelated but I guess your turrets and cannons works the same right? Because I see that you create two differents objects for each, meaning that you had to duplicate the code for each, when you could diplucate them on layout then mirror the sprites and use a single code, it would simplify things a lot; if you don't know how to do I can help on that too ~

  • I forgot to ask, do you have free version or complete version of Construct 2 ?

  • Well that's the problem, if the instances are destroyed, the program can't check their variables anymore as they're destroyed with the sprites, you would need to turn them invisible instead, but that can become a bit fastidious;

    There are better methods that relay only on triggers instead of loops, give me some time and I'll prepare an example for you ~

    EDIT : before I prepare the example, do you know about loopidex and how to use it?

  • Okay so, when you say "kill those sprites", you don't destroy them right? They are still somewhere in the layout? Just to be sure

Tomycase's avatar

Tomycase

Member since 3 Apr, 2016

Twitter
Tomycase has 6 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies