Debug Layout

0 favourites
  • Hi all,

    I have started to to play with the debug thing.It's cool.

    But I noticed some weird thing.

    I have an event which spawns a sprite very 0.1 secs but it will be destroyed after fading out(Fade out behaviour enebled)

    So I would have an average of 20 objects on the layout all the time.But it occasionally rises to 200 objects and falls suddenly.

    Why is this?

  • any chance you can post the capx ?

  • RamPackWobble

    Capx....umm...uhh....I will show you a Video

  • Actually I was thinking that there was something in the code that was causing this spike...

    Can't tell from a video

  • Ok.Wait,I will go home and PM you the capx.

  • RamPackWobble

    Found the bug.First see this capx.Don't bother about the code and all.

    I have just included some backgrounds etc and some more maps.(and some sprites named obstacles) in my actual game

    So this is the area where the bug is.

    Whenever a new obstacle is added by this code,The object count increases.I think the object is spawned every tick.How do I make it right?Trigger once?If I put that,The obstacle would appear just once and never appear again,(The maps are randomly created,see the capx)So If the trigger once is added,It will trigger just once and never again.I want the sprite obstacle to be present in all the instances maps it's assigned to.

  • if I understand you correctly:

    you want to go through each map (1,4,7,10,and 12 (and there might be , for example, 5 lots of map01)) once (and only once) when the score gets above 5 ?

    if so then (I think) all you need is on your event

    System : Score>5

    a second condition

    system : Trigger once

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if I understand you correctly:

    you want to go through each map (1,4,7,10,and 12 (and there might be , for example, 5 lots of map01)) once (and only once) when the score gets above 5 ?

    if so then (I think) all you need is on your event

    System : Score>5

    a second condition

    system : Trigger once

    No.I have just one map01.

    Look at the capx.There are two maps in total(That is randomely spawned)

    Once the last map reaches 0.5*self.width, another map is randomly chosen and spawned next to it.

    If the score is above 5,I want the obstacles to be always present whenever the map is spawned.

    (Hope I made it clear enough)

  • Give each map an instance variable/ boolean that you can use to see if that map has already spawned a new map. Then you just need to add a condition below the "have I travelled more than half way yet ?" saying "If I have not yet created a new map do so but remember I have already done it so I don't do it again"

    https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/harry%20potter%20test.capx

  • ah.I don't understand.What I'm trying to do is,to create a sprite object on the map(map1 for example)

    That is after Score reaches 5.Once score reaches 5,the sprite should always spawn with the map.

    See this Capx

    .Everything is like what I want.Sprite "hangskeleton" is spawned whenever map 1 is spawned.I want the sprite to spawn once for each map01 spawned.But it appears that skeleton is spawned every tick.

  • Thank you soo much.

    But why did that work?What's the logic?How is it different from my other capx?

    (I am very maths type so I will need proof for my mind to work correctly )

  • in your example you are saying (every tick)

    if score > 5 then ....

    in mine I am saying

    is the map almost off screen ? Yes then

    has the map already called for a new map to be made ? no then

    Call for a new map (once) and while there check the score if the score is > 5 add the skeleton.

    so it only calls for a new map if the old map is almost off the screen and the old map has not yet called for a new map. The call for a new map also checks the score and acts on the skeleton accordingly.

    Make sense ?

  • in your example you are saying (every tick)

    if score > 5 then ....

    Ok.I knew it...

    has the map already called for a new map to be made ? no then

    Call for a new map (once) and while there check the score if the score is > 5 add the skeleton.

    .... and the old map has not yet called for a new map.

    Make sense ?

    Where does this already/not yet called comes from?

    I understand all other parts.So,because the function was a trigger which was only called once,the skeleton was created once.Am I right?

  • The already called/not called is the green highlight in the earlier screen capture/ event sheet picture.

    The function new map should only be called once per "old" map - part of this function is now to check the score and create the skeleton if the score is over 5 (in this example)

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