cacotigon's Recent Forum Activity

  • locohost

    I wrote a tutorial a while back on picking instances within the same family.

    https://www.scirra.com/tutorials/556/understanding-picking-with-respect-to-families

    Here's a quick picture of how to do what you're asking:

    You have to pick instance A, and save the properties you need to temporary local variables, *then* pick instance B.

    So this is what your code might look like:

  • nimos100

    Colludium already gave an example of this earlier in the thread. Using Overlap + Trigger Once, you may run into a situation where the the original object overlaps a second object while still having already overlapped the first one earlier in time. When this happens, Overlap + Trigger Once will fail to trigger.

    This limitation can get exacerbated if you make use of families: Obj1 Overlap Family + Trigger Once.

    For example, you have a Farmer object, and a Fruit Family which consists of three different objects Apple, Oranges, and Caimitos.

    Your collision routine is:

    Farmer Overlap FruitFamily + Trigger Once --> Spray the fruit with pesticide. (the fruit remains)
    [/code:1092tdzb]
    
    Here is a situation that might occur:
    [ul]
    [li] Farmer is walking quickly through the garden[/li]
    [li] Farmer overlaps an Apple[/li]
    [li] Overlap triggers and fruit is sprayed.[/li]
    [li] Farmer sprite is fairly large and overlaps an Orange [/li]
    [li] Since the farmer is still overlapping a FruitFamily (the apple), the overlap event will not be triggered.[/li][/ul]
    
    So basically, the overlap will NOT trigger again until the farmer is not overlapping *[b]ANY[/b]* FruitFamily objects. On collision does not have this limitation.
  • Colludium

    Unfortunately, even if the window and layout dimensions are identical (which means C2 only creates a single cell, https://www.scirra.com/blog/ashley/6/collision-cell-optimisation-in-r155), I still see the same performance degradation with the collision_test_capx sample.

    Oddly, I've never run into this issue even with thousands of objects in a level with "On Collision" because I have a hibernation system that periodically puts objects that are too far away from the player into a "suspended state". Then, I have upper-level picking conditions filter only active objects before the "On Collision" subevent.

    This is in contrast to C2 best practices: (quote from Ashley)

    [quote:1ts1pur8]Make sure collision conditions are the first condition in the top-level event. When no objects are picked, the collision conditions can make efficient use of collision cells to reduce the number of checks made, ensuring performance is good in all circumstances.

    If Is overlapping (or On collision) comes after another condition which has picked certain instances, it can no longer use collision cells ... If a prior condition picked a large number of instances, it must brute-force collision checks again.

    I agree with what everyone has said so far, I'd love to get some official feedback about this.

  • lucid

    I think this is expected behavior.

    I usually have my creation methods wrapped in a custom function called "Spawn (ObjectName, X, Y)" which returns the UID of the new object. If you explicitly pick by UID after the creation, then this problem shouldn't happen.

    It's best to just have a master Creation function to handle spawning of all objects. Having it also lets you "spawn by name" so you can easily switch Enemy.Projectile = "HomingMissile" or Enemy.Projectile = "RegularBullet", assuming these are Object Type names. Keeps your code clean.

    EDIT: Screenshot

  • bernivic135

    I'd also recommend giving the plugin architecture another shot. Just take a look at some of the existing plugins / behaviors js code. Start by deconstructing the simpler ones, for example rotate/sine behavior, and then move on to more complex ones like platform. Honestly, I think it's fairly straightforward. I have a simple template behavior and template plugin that I use as a sort of scaffolding when I need to quickly prototype new ones.

    There are already tons of people who have written addons for C2. It really depends on what you're trying to accomplish.

  • This capx you've uploaded has this problem and/or your sidescroller game? We still need more details. Are you talking about native browser (safari/chrome) on tablet/phone, or wrapped like CocoonJS or PhoneGap?

    Just tested this capx on my iPad 4th Gen using web preview without any problems. Could be a speed issue.

  • noisetank

    Check the collision box X values on each tine to make sure they are identical (set them to whole numbers). If you have Pixel Rounding set to OFF, and the values are fractionally different, the fork may not collide correctly.

    EDIT: This goes for the two boxes as well.

    Here's a capx:

    https://dl.dropboxusercontent.com/u/12667027/ForkTest.capx

  • Steely

    Yeah, the pin behavior will not reflect changes in the parent's height/width. Fortunately, it's fairly easy to roll your own generic pin system using Controller + ConnectedSprite by using families.

    I'm not sure what you're seeing without a capx, but here's a simple example manually re-positioning the head without seeing the popping-off behavior. And as a last resort, you can always turn your bug into a feature by repurposing your game into rockem-sockem robots.

    Here's a demo:

    https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/index.html

    Here's the capx:

    https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/ImagePoint%20Attachment%20%28not%20pinned%29.capx

  • Hmmm, I'm not sure to be honest. I think the standard Chinese fonts (at least for Windows anyway) are SimSun which is used for simplified and SimHei which is largely used for traditional Chinese.

    As far as Android, I believe that the default typeface Droid includes support for Simplified Chinese (GB2312) and Traditional Chinese (Big 5).

  • Hey part12studios,

    I've done a fair amount of Construct using Chinese though I make use of 繁體 mostly since I develop for Taiwan frequently. If you set the font to a Chinese font like 黑體 for example, they should display in the layout correctly. Also, even if the font displays as boxes in Construct, if you run a Web Preview or export the project, when testing in browser it should correctly display Chinese for the user assuming user has a standard Chinese typeface installed.

  • Internally, Construct never actually stores an "AngleOfMotion" value. Whenever the behavior or user needs the value, it recomputes the value via the arctangent based on the current vx/vy, these being the horizontal and vertical velocity values. This means that when you set speed to 0, vx and vy also get zeroed out and the angle now returns 0.

    If vx and vy were instead inferred from angle and speed (aka: vx = cos(angle) * speed, vy = sin(angle) * speed) then this issue wouldn't occur.

    Steely

    I'd recommend taking a look at using the system time scale (setting it to zero) to create a pause for the game instead of manually managing all the objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On timer "t" can fire with multiple picked instances if the timers happen to fire at the same time.

    Seems like I'm not the only person who has encountered this issue before:

    https://www.scirra.com/forum/r193-picked-count-with-timer-event-bug_t122230

    https://www.scirra.com/forum/timer-is-this-by-design_t93210

    Ashley Can you please add this to the manual for Timer? Given that Start Timer runs at a per-instance level to begin with, it is not intuitive that internally Construct groups coinciding times for the timer (which bears similarity to a trigger/callback such as "on collision") SOL On Timer event to include more than one instance if possible.

    Knowing this would have saved me about an hour of debugging.

cacotigon's avatar

cacotigon

Member since 10 Mar, 2009

None one is following cacotigon yet!

Connect with cacotigon

Trophy Case

  • 15-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies