Nabu's Forum Posts

  • Here is a modified .capx that, I hope, does what you expected. The tilemap you're using is just here for coordinates, as the creation of "ressource" object doesn't affect it. "Ressource" object is not a tile and doesn't modify tilemap on creation, so you don't have to test if the tilemap is empty under the pointer, but only if the pointer already overlaps with the object. If not, you can create one at the desired position.

    I also modified the coordinates for object creation on the tilemap. The origin of your 32x32 sprite is in the top left corner, so you have to create it at -16/-16 pixels from the position given by the expression TIlemap.SnapX and SnapY.

    https://www.dropbox.com/s/vi4gtp4xwc9fnqn/tilemapExample1.capx?dl=0

  • Hello,

    You can add object in game using the System action "Create Object" or the Object action "Spawn Object". For an object to be spawn, an instance of this object type must already be in one of the layouts before, like objects on the side offscreen or in a loader layout.

    You can't add instance variables in game, but you can attach an array or dictionary and keep the UID in an instance variable to store and manage variables in game.

    Hope it helps

  • Well... Of course... You're right... I didn't thing about before asking. Lol

    A kind of example of your signature it seems.

    And thanks

  • Hello,

    I had a harddrive failure and I lost an entire project (medium big one... had no backup like a creep). Finaly I managed to find an older NodeWebkit exported version so I can get my graphics and sounds back from the zip archive. But I would like to know if it's possible to retrieve the Constructs 2 Events and Layouts from a compiled version.

    Anyone knows ? Thanks a lot.

  • Sorry for the delay. Ok, you want your bomb to suddenly appear on top of a random floor tile ? Or you want it to move until it reaches the tile ?

    Can you post a link to you capx project ?

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Hi,

    You can use the Sytem option Layout Scale to scale whole layout, layers and objects in it, or do it for each object with the scale property of these objects.

  • Sorry, I did not understand. You want to randomly move the bomb every X seconds, or spawn random floor parts ?

    If it's moving the bomb to a random position, it's something like that :

    Every X seconds => Set bomb position to X(random(x1, x2) and Y(random(y1, y2) with x1, 2 and y1, 2, being the intervals.

    If you provide a small capx, we should show you more precisely.

  • Ok, I was a little bit confused so I misread some things. Thanks to you !

  • Hello,

    I'm pleased to study a bit you capx and work around with Multiplayer plugin for tests. One thing remains obscure to me : in the "enemy" part, which seems to be shared by both host and peer, you gave a random point for the enemy patrol behavior ai. I don't understand how this does not conflict with multiple connected instances of the game. I mean, is the random function already synched when in multiplayer for secure random number generation ? (Or do we have to program this by ourself ?) I saw that it works, but why ? Why this function does not return different values ? And why it is done on the peer instance ? This should be only on the host that make all the calculations and send to peer via multiplayer messages or synched objects, although I know there's many ways to implement game logic in multiplayer (like host does main calculations and send results, or host and peer have the same simulation synchronized by functions, etc...).

    Is it because the TankBase is synched so when you do a modification, it's done once ?

    I saw that you disabled a random angle set at Projectile object creation. Is it for the same reason ? Because the object is not synched, so you can't use random function and set the spawner object's angle to be sure it shared ?

    I miss something. Do you have some time to explain me more ? I feel lost ! The multiplayer plugin is the most difficult to deal with in Construct 2.

    By the way, thanks for your useful template !

  • Hello,

    "Every X seconds" doesn't work per instance, so if you want several objects of the same type or family firing, only one will.

    You can add an instance variable (named "timer" for example) and at every tick (or every x seconds), for each object, add dt (in system expression) to the timer. In the same time you check if the timer is higher than a value, and if it is, you can fire.

    • Add a "timer" instance variable for your object.
    • Every tick => for each object => add dt to object instance variable timer

    - If timer is higher than value : can shoot.

    I hope it's clear enough. Sorry I don't know the Rexrainbow's timer plugin.

  • Hello,

    First I'm sorry to post this in the general discussion, but I've already posted three times a similar topic in the bugs section that was moved in the closed bugs. The problem is related to creating objects with physic behavior on the fly. As seen in this topic https://www.scirra.com/forum/physics-error-and-crash_t150137, other people encounter the same bug, and it seems to be not linked to how many objects you create even though the bug occurs more often with many objects created.

    After testing, and reading others comments and experiences, I'm pretty sure it's not the "way" asm.js is programmed, but a memory leak.

    So I posted here because Ashley closed the topic each time with no more explanation and we can't discuss any more about and maybe find a solution.

    If someone is interested, we can go further together. It's a big issue for me as I'm working on a commercial project and at the moment I'm stuck on this (it crashes the program).

    Thank you all for your time.

  • Ooh... So why do we encounter the problem when there's only few objects in game ? I really don't think it comes from the memory limitation, but rather a memory leak.

  • Problem Description

    Physics behavior bug / crash when creating objects on the fly. Possible memory extension fix in beta r209 did not fix the problem, and does not help to support more objects.

    Attach a Capx

    https://www.dropbox.com/s/et90z0zdwswqepe/physics_bug.capx?dl=0

    Description of Capx

    Simple layout with physic objects. Left mouse click to spawn coins high rate.

    Steps to Reproduce Bug

    Just spawn some objects with left mouse click, (hundreds of them, it's fast) and the crash will happen.

    Same capx from previous bug report.

    Observed Result

    App crash with physics behavior related debug data.

    Expected Result

    Being able to support more objects. The problem also shows with tilemap with physics behavior.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7 SP1

    Construct 2 Version ID

    Beta r209

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads