Tomycase's Recent Forum Activity

  • Yup it's definitly this, and looking at your event, I can understand why it increases so fast, since your asking the program to spawn a sprite from the same sprite, which mean each laser will spawn an instance of itself, each time multiplied by the new number of instance which keep increase;

    What do you want to achieve with this event? So I can look for a fix

  • On the left of the debug menu, you have the list of all the objects in your project, and next to the names, the number of instance of each object; On the top bar of the debug menu, you can see how many objects are currently created on the layout;

    On your screenshot, there is over 51000 objects at once, that can only mean that an event is creating continuously instances of an or multiple objects, this number isn't normal at all;

    What you need to do, is to look which objects in the debug list has a very big instance number, and once located, find the corresponding event in your code;

  • You can guess that this is in fact very normal, as your lasers are gradually destroyed to avoid memory issue, and 8 instances is nothing for the memory;

    I was talking about a non-stop increasing number, there must be an object instance increasing abnormally, I see on the top left that there are 51 109 objects on your layout, that is enormous, no wonder your game is slowing down, continue to look for it

  • It probably doesn't come from those loops, there are probably other pieces of code in your game in which an event is positioned wrong and keep creating objects or something like this, check in the debug menu if one of your object instance number increases constantly

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It works perfectly fine now, thanks ~

  • 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 ^^

Tomycase's avatar

Tomycase

Member since 3 Apr, 2016

Twitter
Tomycase has 6 followers

Trophy Case

  • 9-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

15/44
How to earn trophies