Pandy's Forum Posts

  • Hey all

    I am having trouble trying to figure out why collision checks happen even though all the objects in that layout(main menu) have collisions disabled.

    In my menu i've got the buttons and text to move in and out of the screen as needed when touched. In the Debugger it shows that the collision checks happen when the objects are moving and then back to zero checks when they have reached their destination position.

    I have double checked and all the objects have collisions disabled and i've even put them in a family and disabled collisions on startup. But it's the same.

    I noticed that when i put a new object with frames in them ,the collision checks had increased in count, could it be anything to do with objects with animation frames?.

  • Hello all,

    So i have a ragdoll type character in my game whose body parts(legs,hands,feet etc etc.) are all attached to their respective neighbor parts via revolute joints(physics behavior). Now when i previewed my game over lan with the cacoonjs app on android, some of the body parts were higher in position( Y value ) than they were supposed to be. They are not in the same position as i had placed them on the layout or as it shows when previewing on desktop.

    This is not for all the body parts, the left leg of the char is noticeably higher than the right leg and both shoulders are also higher up the body making it look kinda weird. I have put an 'on start of layout' event that places the body parts in their desired positions but it still gets offset.

    Is this a bug?

  • [quote:3r8eqs02]What my group does is it actually turn Off/On whether an object should even be checked for collisions based on distance between objects.

    Oh, i was using the 'distance>/<n' as megatronx was saying. I thought you were just using groups for your convenience.

    I need to know how to do this, ill try to figure it out, but if you don't mind giving a quick tut.

    And i noticed that instance variables aren't triggered or set as needed when the 'overlapping..' condition is met, it gets triggered or set when 'on collision..' conditions .

    Oh thanks you put up an example.

  • So what you have found is that :

    -Using 'overlapping object' is only slightly better than 'on collision with object' when either condition is checked every tick.

    -Using 'overlapping object' is significantly better than 'on collision with object' if it is checked only when the ball(for example) is within a certain specified range of the target object.

    Well ill test it out and see what i find. Thanks for the help.

  • Hey all

    I realize that having a game with multiple collision events can put a drag on performance. Let's take an example of a ball hitting objects on the screen. Say obj1 is near the right, obj2 is near the left, obj3 near floor etc.. and if ball hits obj1 the ball turn blue,obj2-red etc.... So these objects are at certain x,y positions.

    What i would normally do is, make an event 'when ball is in collision with obj1-turn ball blue'. Now what if added another condition of 'ball is within x' , where the object lies within the x limit. Will this help on improving performance?. instead of checking for collisions every tick for every ball-object comb, it would only check if ball is within the object's x range. Does it work that way?, or have i mistaken it?

  • My project properties orientation is in landscape. I preview over lan on my mobile browser and the games orientation stays in portrait , my game is only playable in landscape mode. I have a touch action which controls the sprite character's hand's direction of pointing. In portrait this does not work as when i touch the hand always pints up no matter where i touch, so i need to get this issue fixed.

  • Iv'e got the preview over lan thing working, no problem there.

    My concern is with the browser in which i preview. I understood and expected the drop in performance in my game when previewing on mobile over lan,but in fact i got 58-59fps, but only when i previewed in chrome.When i tried with other browsers(opera, dolphin, default android one) i got about 20fps, and the game sprites(everything actually) looked pixelated and my objects with physics behaviors decided it would be a nice time to fly all over the place(game unplayable). I also only used chrome when i ran my game on my laptop.

    I'm really confused as to why the game ran so well on my phone in chrome browser and horrible on other browsers. I don't really know what to expect for my game's performance on mobile.

    I hope this is a general topic, or should i post it elsewhere?.

  • Thanks both, I ended up using PixeRebirth's method , seeing as he mentioned it was more accurate. I had to add more events though and a sub event to only trigger the ball spawn once. Lol i didn't at first and my screen was filled with them.

  • Ah thanks a lot. Seems so simple now. I didn't think about putting a variable for it. thanks again

  • Argh i don't have the latest version of C2 , so i couldn't open it. My internet is the bane of the universe and i have others at home using it so i can't really upgrade now. Anyway to open it otherwise?.

  • Ok, Imagine a dodge-ball game where a ball is created every 5 seconds and hurled towards the player , and the player's goal is to avoid it.

    Now when the player is hit, it toggles a variable which stops the balls from being created and hurled, towards the player.

    Then a 'are you ready?' button pops up, which if clicked would toggle the variable again, and the balls being created every 5 seconds, will resume.

    The problem is, Imagine i clicked the 'are you ready' button 1 second after it pops up, then the ball appears 4 seconds later. I click the button 3 seconds after it pops up, the ball is created after 2 seconds. You see where i'm headed.

    So if i waited for a long time to click, past 5 seconds. Say i clicked it after 8 seconds,then a ball immediately flies into the screen. This catches the player off guard. How do i prevent this.

    Same issue while restarting the layout. If i restart it with just 2 seconds left for a ball to be created, on the restarted layout a ball appears after 2 seconds only. If there was only 0.00009 seconds remaining for a ball to be created, then on the restarted layout a ball appears immediately. Unlike where it takes 5 seconds for a ball to come if i started the layout for the first time.

    Anyone have a solution?

    Sorry for the essay lol

  • Hmm don't know what i'm not doing right. One thing i realized was, when i reverted back to my disable each individual object's physics collision with family event, it was going haywire again. I was confused as it worked before and now even this method is not working, Then i realized i did not delete the physics behavior for the family, Having the physics behavior on for the family caused the crazyness. It was fine after deleting the physics behavior for the family. Maybe it's cause the sprites in the family also have physics behavior. Thanks anyways mate.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Family1 disable physics2 collision with Family2(duplicate). Well i tried that and had the same problem. Guess it's not such a big issue to have an extra 10 events. I can live with that. But if it were an extra 100 events vs just 1 then i would be bursting my brains out. Thanks anyways.

  • Ok, so i had made a character with the ragdoll type method, so i had separate sprites for arms, legs, body ,head etc... Pinned them to each other and all was fine. Now this was before i bought C2 so there was no family option for me. i wanted the body parts to not collide with each other as it made the ragdoll go haywire. So i had to do the tedious task of disabling physics collisions of each part with the other. Which worked and the ragdoll didn't go mental crazy.

    Then i bought C2 and hooray i said as i created a family with all the body parts in the family, and i put a physics behavior for the family, which shows up as Physics2(if anyone can also explain as to why it is shown as Physics2) so i could disable family colliding with family(itself). But it didn't work. The ragdoll went nuts as the first time it did before disabling physics collisions.

    Is this not the way to prevent family on family collision?, Is there another method?.

    It works if i prevent each sprite of the family to disable physics collision with it's family, which is fine but it would be nice if it could be done with just 1 event instead of 10 or so events.

  • Hey all,

    I have tutorial capx on menu button animation, as in how to bring the buttons in and out of the screen. Say i want the button's Y coordinate to be 500 at all times with varying X as it moves into the screen. So in the capx, it has an 'on start of layout' event giving an action to place the sprite at (for example) X:1000(outside screen),Y:500. So i would only need an event that varies the X coordinate to the desired value to bring it into the screen rather than having to bother with the Y coordinate as well.

    I want to know if the 'on start of layout - place sprite in x, y' event is necessary. I mean i could just manually place the sprites on X:!000,Y:500 on the layout and i would not need that event.Every time i run,the sprites would be where i put them. If i didn't bother with having that on start of layout event would it affect the sprite's position on the layout if i exported the project to mobile platforms?.