Nabu's Forum Posts

  • Hello,

    The problem you have is probably related to SCOPE, object picking and object creation. The functions have a scope, itself, and almost everything outside is ignored. So when you call the "spawn_ship" function, it works as expected. But when you call after that the function "set_FactionRed", the latest created SHIP_small instance is out of scope. Also, when you create an object, you can just set up its variables in the first following event scope. When you press F a second time, your function "set_FactionRed" will get al last the first instance of the SHIP_small object type, due to the fact that objects are accessible the next tick they are created (except modifying them just in the same event scope after system => create object). That's why operations in the "spawn_ship" function works correctly but not operations from the "set_FactionRed" function.

    I hope it's not confusing...

    So what you can do is putting everything in the first function (quick but not very practice), or put the "returnValue" property of your functions with the UID of the nely created object (Object.UID, not ID as it's not reliable) pass it (Function.ReturnValue) to the functions that are following. In these functions, you have to pick the instance by UID first (so in a function, it's with Function.Param(something)) and do the modifications you want.

    Not confusing ?

    I'm not very good in english for explanations...

  • Hey, here's a little example with spikes that goes underground endlessly. I set up three types of spikes, just changing the "wave" property of the Sine behavior. Note that the "sawtooth" wave equation is probably what you want. Just check the collision with the sprite and players/entities and do as you like. You can add randomized values to the Sine behavior if you want it to be less predictable. The "width/height" parameters of the "movement" property could be good too as it scales the objects. The magnitude is how large is the movement, in pixels or percents.

    You can see that the spikes are on the "behind" layer, with "tilemap" layer in front.

    This is a simple way to do that. You can also have custom movement by writing your own and changing state and position of the spike object every tick or less. For example you can add a "active" bolean variable to the sprite and set it true only while it's rising from the ground, setting false while retracting. When you're checking for collisions you can also check for if the spike is active or not. If it is, hurt the player, if not, the player can walk upon it.

    Hope this helps if you haven't already find a solution.

    https://www.dropbox.com/s/9xusp6gx0y00e0u/spikes.capx?dl=0

    Cheers

    Nabu

  • Hey,

    Just wanted to know if there's a way to display the pathfinding obstacle map. It would be useful when debugging a project.

    Thx

  • I managed to correctly draw the Tilemap with your tip R0J0hound. It works pretty well and allows the rest of a game development. The probleme is mainly with Particles and Spritefonts that are a little bit harder to move, paste and move back. That's why I wanted to simply move the viewport, but it doesn't work well.

    What's exactly the problem with the project I attached ? Why the viewport get stuck in the last moved position ?

  • Hi,

    I have a problem with the function "Scroll To Position". I'm trying to set up a split screen game with the Paster plugin. The fact is that some object (tilemaps, particles, spritefonts) are not displayed if not on screen. So I have to move these objects every tick to the player position to paste them on the canvas and move them back to their position. As an alternative I tried to just move the viewport to player position, to make everything near him onscreen. But this didn't work as expected.

    So every tick I scroll the viewport to the player position. If there's one player, it works well. But with two players and two canvas I have to scroll the viewport twice in the same tick. The view port seems to be stuck in the last scroll position as the special objects that require to be on screen are not displayed if player 2 if too far from player 1.

    I made a little project for example. You can seen that the tilemap is not always paste onto the first screen (player1) unless player 2 is close to player 1.

    https://www.dropbox.com/s/jrmxp8yim7h7rpn/splitscreenScroll.capx?dl=0

    So is it possible to scroll twice in the same tick ? Or is there something to do to achieve this ? Cause I find moving all objects to fixed viewport and moving them back sometimes hard to implement with big project and moving the viewport would be more simple.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your help Coin Coin ! , but I think this won't work with the Tilemap, as the tiles are one whole object and I can't hide some tiles while other are visible.

    Actually I can have the desired effect (hidden walls) if the walls of the TIlemap are black and the shadow is black too. Thus everything that is in the shadow merge together.

    Anything else ?

  • Hello,

    If I have a Shadow Light object and some walls (tilemap) with Shadow Caster behavior on top of layer (as I want to display it and not being shadowed) , is it possible to display only the walls that are close to the light source and not all of them ? If a wall is separated from the source by another wall, I'd like to not display it.

    Anyone has found a solution or it is impossible with the implementation of Shadow Light object ?

    Edit : here's a modified image from a previous post that talks a bit about what I want.

    This in construct 2 :

    https://www.dropbox.com/s/6vsoblo56a2qzz4/shadow1.png?dl=0

    What I would like to have :

    https://www.dropbox.com/s/ixr9t3lcc3vx81f/shadow2.png?dl=0

  • Hello everyone,

    I got a bug reported as a javascript error when using the Physics behavior on a Tilemap object and filling the tilemap at layout start. That works fine if I fill the map in the editor, the problem only shown on filling on the fly or at layout start.

    Here's a .capx that reproduces the error. I tested with Chrome and Firefox. The probleme seem to be in Box2D.

    https://www.dropbox.com/s/da681ahpwe98x3x/TilemapPhysics.capx?dl=0

  • Up.

    Sorry but I could not find any solution for Shadow Light object and Paster, as the Shadow Light is only drawn onscreen.

    I saw the beginning of a discussion about it on the Paster topic, but no solution.

    Do you have a tip for this ?

  • It works, thank youvery much.

    How about having two Tilemaps (one ground, one solid walls), on separate layers and pasting Shadow Light ?

  • Hello,

    I'm trying to set a split screen user the Paster addon, as described in this tutorial :

    https://www.scirra.com/tutorials/1032/g ... creen-play

    Everything works except when i add a Tilemap object to the layout. Attached is a modified capx from the example above to illustrate. I just scroll the viewport to the bottom left corner at layout start and added a Tilemap.

    The Tilemap object appears only inside the viewport. So for the player 2, starting from right bottom corner of the layout, outside the viewport, the Tilemap is not displayed. You cas only see the green part from the player 1 screen. I think this might be caused by the tilemap behaviot that only display tiles that are inside the viewport, despite of the Paster addon that access image data from outside the viewport.

    Has Anyone ever found this ?

    Nabu

  • Hello everyone, hello Locohost,

    I'm on this at the same time, trying to find a simple and clear way. So I tried different things, but I got half satisfaction cause it's a trick and not a native function of Construct 2. So in a large project, using tricks would be confusing.

    In my project I got a general family of entity and I'd like them to be able to chase (chaze ?) or follow each other. Barely the same with your fighters.

    If you find a cool way to do this, can you share it please ?

    It seems like dummy object is a solution, but it involves creating more and more objects. Ok this dummy doesn't need cpu intensive calculation like collision, and it is invisible in the game, so no extra draw. In my project and because of the family behavior and the difficulty to make "complex" interactions between two members of the same family, I got lots of these kind of solutions. I came to Construct 2 with knowledges in programming languages and game programming. With an engine of your own, you can have references to two entities in the game inside the same function to apply modifications on both simultaneously. Hard to do that in Construct 2 without breaking the event system optimisation (lots of picking, and reset picking list), or doing something unreadable.

    If you find a good solution, I'm in for sharing

    Good luck and sorry for my english might be incorrect, not precise, or really strange sometimes.

    Nabu

  • Hello,

    I've gone through a problem using the for each loop built in the array. I find the lack of a "stop loop" action to exit the loop in certain condition. Maybe it could be added in futur version ?

    This is the link to the topic, and a temporary solution suggested by linkman2004.

    https://www.scirra.com/forum/viewtopic.php?f=147&t=125376

    Thanks to everyone.

    Nabu

  • Thank you very much linkman2004 for your help. I solved this buy using a system For loop with a variable and look at value each iteration. But the solution you provided with a variable for completion is cleaner.

    I'm gonna make a request.

    Nabu

  • Hello,

    I tested something simple. I hava a 2D array. Going through its X axis, test variable here, and stop the loop in some cases.

    So :

    • For each X element in array
    • test variable value at x, y
    • if value == 0 => do something
    • else => stop loop

    [attachment=1:q1x0vq5p][/attachment:q1x0vq5p]

    The system => stop loop action does not stop the iteration of the for each loop.

    Am I missing something ? The stop action should prevent the iteration after it, no ?

    Here's the capx : [attachment=0:q1x0vq5p][/attachment:q1x0vq5p]