Matei511's Forum Posts

  • If you add Black and Red sprites to the same container, then they will exist in pairs. You will be able to simply do "Pin Black to Red".

    If you don't want to use container, try this code:

    > System-> For x=0 to Red.count-1
       System -> Pick Nth instance of Red instance=loopindex
          System -> Pick Nth instance of Black instance=loopindex   :   Black pin to Red
    [/code:1e5unmc5]
    
    In both cases sprites will be pinned to each other in the order they were created. Black sprite with lowest UID - to Red with lowest UID and so on.
    

    The problem with containers is that i can create one object and at the same coordoinates. I need multiple objects with multiple instances pinned on diffrent posittions. I noticed now my example capx was flawed and induced you into error. The code won't let me do this right?

  • The easiest way to explain this is by using a capx. I am trying to pin each black square to each red square. So every red square has one black square pinned to it. I tried giving the black square and the red squares i want to pin variables with the same value and use pick by evaluate, but as you can see in preview, all the black squares are pinned to the first square and only the first. Pinning each separately with an event for each pin won't help, since i need this for a bigger project , in which i would have to pin 5 items to each of 50 items. SO 250 events just for pinning.

    Here's the capx: https://www.dropbox.com/s/q3taxjibvlv1t ... .capx?dl=0

    Hope you can help me and thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So i want to have something like 8 rooms in my level. The rooms are big (800,1440 pixels). Is it more efficient to use 8 different objects or use 8 instances of a sprite containing 50 or so frames, each frame being one room and set the frames when i need a different room? Does the number of frames influence performance? Even when they are not being used?

  • The system only checks for collisions when it's needed - if you have events "On collision" or "Is overlapping" or if there are behaviors on the objects that register collisions (platform, physics etc.)

    So normally your destroyables should not generate collisions check with the walls.

    You said your layout is (1400,800) - is this in pixels or is this the number of tiles on the tilemap?

    If in pixels, it's not that big and you should be able to use tilemap or even several tilemaps on top of each other.

    If you have lots of individual sprites like destroyables, you can disable/enable collision for them if they are too far from the character or in another room etc.

    System-> Pick by comparison-> Sprite where distance(Sprite.X, Sprite.Y, Character.X, Character.Y)<100 : Sprite Set collision enabled

    System-> Pick by comparison-> Sprite where distance(Sprite.X, Sprite.Y, Character.X, Character.Y)>=100 : Sprite Set collision disabled

    Thanks for the help. There is a very weird thing tho. Something must have went wrong in that project because i copy pasted the room, tilemap, destroyables and players from the other project to a new one, and no i only get a maximum of 40k colission checks, which is way better than 4 million. I didn't have any on colission or overlap events. Weird. I will use your tip anyways, i will aim for 60 fps even on older devices

  • so apparently it was not only the tilemap that caused the problem but also a lot of small object that i also had checking for colissions. since these objects don't move and could never collide with the tilemap anyways, is there a way of checking for colissions only between certain objects (so the player and the destroyables, but not the destroyables with the walls?

  • I have a big room (1400,800) and i am trying to figure out how to do colissions properly ( it's a dungeon so there are a ton of walls) My room is one big sprite(i didn's use a tilemap because i know it's not good at having a lot of diffrent objects like scenery and also i would need something like 3 or 4 of them (because you have no layers on c2 tilemaps). So i have this big image with no colissions, so i just added an invisible tilemap , resized it to be as the room and started making the colissions manually. It works as intended except the fact that i get 4 million colission checks per second in the debugger and lag on mobile. I then instead used like 20 smaller tilemaps (because i read about colissions on the blog and how they are registered) and now it works well, but it's very tiring and takes way too much time. And that's just for one room, and i plan on building over 50. Is there a better way to do it? Or some way to split a big tilemap into 20 smaller ones?

  • > So i was wondering what is more efficient: having some large images (512 by 512) or 2 tilesets over each other (i need more layers) the image will have both tiles that repeat a lot(walls, corners, etc.) Which i know adds benefits to using tilemap, but also diffrent small parts (cracks,vases,chains,etc.) That are very diffrent, don't appear many times and need no colissions. So which is better?

    >

    i know that tilesets are best for performance

    I know they are effective but only if there are not a lot of diffrent sprites

  • So i was wondering what is more efficient: having some large images (512 by 512) or 2 tilesets over each other (i need more layers) the image will have both tiles that repeat a lot(walls, corners, etc.) Which i know adds benefits to using tilemap, but also diffrent small parts (cracks,vases,chains,etc.) That are very diffrent, don't appear many times and need no colissions. So which is better?

  • I was wondering how you could spawn objects in a certain way: so i want objects to spawn randomly all over the layout except a circle that follows my player so i avoid them spawning right over the player.

    |_________|

    |...............|

    |...... O ....|

    |_________| (ignore the dots)

    so i tried "drawing" what i meant. i want object to spawn randomly in the rectangle (i know how to do that already) except the circle. So everywhere in the rectange but not the circle. the circle will be moving (following the player)

    Thanks in advance!

  • But the enemies into a family. Then have an event 'on family created, create HP bar'.

    brunopalermo thanks a lot guys! Works like a charm!

  • i am trying to pin a hp to every enemy. There are several instances of enemies, and several types, how do i pin one hp bar to every enemy on the layout, and how do i make them spawn together? (Note: i need all hp bars to be instances of one object, but enemies to be different objects, with several instances) For example i have 5 instances of enemy A and 4 instances of enemy B i need 9 instances of hp bar , each assigned to one enemy, and i want them to spawn together

  • Hi! I had the same problem but after a while I solved it. Here is the link of my topic

    says it can't load the plugin , what version of C2 are you using? can you give me the link to where you downloaded the plugin from please?

  • I am trying to implememt ads to my game but it doesn't work. I have followed tutorials on the forum but i get an error when trying to test it in the engine and a black screen trying to test it on mobile. Disabeling any ad related events makes the game work fine.

  • I want to make a curve using square blocks in a top down game an i was wondering, performance wise, what would be the most efficient way to do it. The goal is to spawn rooms and spawn a curved tunnel connecting them. (Both the room and tunnel premade). Also what would be the most efficient way to spawn them ( at the start of the level it spawns random rooms with tunnels connecting them)

  • i followed tutorials online , made an admob account, copy pasted the ad unit id into the cocoon banner adds properties for android. For displaying them i have 2 events:

    "On start of layout: load a banner add" and "on banner loaded:show banner add" . when i try to run the game i get this error:

    "Javascript error!

    TypeError: this.banner is undefined

    http://localhost:50000/ATPAds_plugin.js, line 203 (col 13)

    This may be a bug in Construct 2 or a third party plugin or behavior - please report it to the developer following the bug report guidelines. Subsequent errors will be logged to the console."

    if i disable the 2 events everything works fine and running it on android works fine aswell. Looking at forum posts about the error, somoene said that the error is normal and it doesn't matter because the game will work when compiled. I compiled it on cocoon.io, added this plugin "AdMob native Ads for Android cocoon-plugin-ads-android-admob" and compiled it. i installed the app and it only shows a black screen. Help me please!