NicotineLL's Recent Forum Activity

  • I have the following issue - Platform is sticking to the bottom of vertically moving Solid objects with the Sine behavior, this happens if the object is moving at certain speeds (usually quite fast)

    My guess of what's happening is that, depending on player object's gravity and the speed of the moving platform, the player might not be able to accelerate fast enough to get away from the sine object on the next frame. That causes the engine to think that the platform has just collided with a Solid object on top and sets Vector Y to 0. This continues until the Sine object gets slower, stops or start moving in a different direction allowing the player to pick up vertical speed and get away.

    Does anybody has an idea of how to counter this issue?

    Tagged:

  • I have tried that before and it would work in the example above, however there are a couple of issues I personally found with this method:

    - It only checks one object and even if you add multiple objects into a family, not all object types can share the same family (like sprites, tiles and 9-patch, etc). So if two different objects overlap while being clicked, then both clicks will fire.

    - Also this logic will be ignored on "button down" and "on release" triggers, unless specific conditions for those are added as well. Haven't fully explored this route though.

    I do believe however that I managed to rubber duck debug my problem by writing my initial post. This is what I came up with 30 minutes later. I haven't fully tested it, but it does work in theory. Here's a screenshot:

    There are two dependencies in order for this code to run correctly:

    1. After a mouse click trigger event we must set allow_clicks to false.

    2. At the very end, after all mouse trigger events we must reset allow_clicks to true.

    - As a fail-safe I also make sure that allow_clicks is true at the start too.

    If someone finds an issue with this solution and thinks it might break at some point I would love to hear it!

    One potential problem is that I'm relying on this code running synchronously, but as of right now I can't find a situation where it wont.

  • So I'm stuck on this issue and I can't find a solution for the life of me.

    I'm trying to prevent double clicking on an object, but it seems that everything I try is either not reliable or straight out hacky.

    Here's a very bare-bones code of what would cause a double trigger:

    - We have an object with instance variable "clicked".

    - On the first click we set the variable to true.

    - On the second click if "clicked" is "true" we destroy the object.

    What would happen however is when we click once, the code will be read in sequence, therefore setting "clicked" to "true" and destroying the object instantly.

    A simple way of fixing this very example would be to move the second click event at the top so it gets checked first and that way it will prevent the double click, however this is easier said then done on a larger scale project with multiple files, functions, etc. so I label this method as "unreliable"

    Second solution would be to create a tick timer and compare against that (skipping the current trigger check), this is how this version would look in code:

    This method will work for most cases and on a larger scale, however to me at least it seems "hacky" and like a disaster waiting to happen. Not to mention if we start using "on click" and "on release" trigger then the click timer would simply not work, since we can hold the button down for longer than the timer.

    I've played with the idea switching layers and visibility, but I'm determined that there is a better solution.

    Does anyone have any clue how to tackle this problem differently?

    Edit: In a way, I want "On click", "Mouse button is down" and "On release" to be treated as one entity and only one event can occur during this period.

    Tagged:

  • Or just pass the UID?

    Since I'm creating items from a JSON file using a function, then getting and passing the UID of the newly created items to another function "didn't feel right", I wanted to go another route.

    I'll play around with the "On created" trigger and see where it leads me. Another alternative I'm exploring is changing the "color" function into a check on every tick with conditions and bypassing the need to call a function altogether.

    Thank you all for the help!

    Edit: Okay, for future reference if someone has the same issue, here's a solution with a check, bypassing the use of picking UID or using triggers ("On created" did not work for me for some reason).

  • I want to call a function on a newly created object, but it does not work unless I pass the object back to it (its UID).

    Is it even possible to do it the way I want?

    Tagged:

  • This is the first thing that came to my mind - https://www.dropbox.com/s/sfa3skfjj8qe9 ... .capx?dl=0 Run it and move the mouse around the canvas. Could be improved for whatever your specific case is.

  • I'm a huge dum-dum... there're regular expression functions - RegexMatchAt(), RegexMatchCount(), etc.

    oosyrag tokenat() uses separator to create keys, I need to get the value in between given characters (what regular expressions do)

    R0J0hound I checked it out, but I'm not quite sure how to work with XML files and this plugin in particular. I think the functions I mentioned above would work in this case.

    Thanks for the suggestions!

  • With the help of R0J0hound I made a script that reads SVG polygon coordinates and creates a terrain.

    Currently it reads it from a .txt file (using tokenat() and creating loop for each shape) which has to be manually populated with information. I was wondering if this step can be eliminated and improve the workflow. However to read directly from the SVG file it needs to get the coordinates in between characters and create a loop.

    For example this is an SVG code

    <polygon class="st0" points="1520.4,280.6 1456.7,280.6 1456.7,339.7 1527.7,339.7 1527.7,357.4 1435.5,357.4 1435.5,193.5 
    	1524.1,193.5 1524.1,211.3 1456.7,211.3 1456.7,263.1 1520.4,263.1 1520.4,280.6 1520.4,280.6 1520.4,280.6 "/>
    <polygon class="st0" points="1550.3,345 1550.6,341.9 1551.4,339 1552.7,336.4 1554.4,334.2 1556.5,332.4 1558.9,331.1 
    	1561.7,330.2 1564.7,329.9 1567.8,330.2 1570.6,331.1 1573,332.4 1575.1,334.2 1576.8,336.4 1578,339 1578.7,341.9 1579,345 
    	1578.7,348.1 1578,351 1576.8,353.5 1575.1,355.8 1573,357.6 1570.6,358.9 1567.8,359.8 1564.7,360.1 1561.6,359.8 1558.8,358.9 
    	1556.4,357.6 1554.3,355.8 1552.6,353.5 1551.3,351 1550.6,348.1 1550.3,345 1550.3,345 1550.3,345 "/>
    <polygon class="st0" points="1556.4,310.2 1553,193.5 1576.3,193.5 1572.9,310.2 1556.4,310.2 1556.4,310.2 1556.4,310.2 "/>[/code:572xu8az]
    
    So it needs to - for each <polygon> get coordinates between points=" and ", and create for each loop.
    
    My question is how to get the value between points=" and "? Is there a system function that can do that (something like PHP's preg_match() maybe)?
  • At this point I really don't want to implement level editor (which might solve the issue once and for all) and complicate the situation more than it already is.

    I might have to rethink my gameplay and tune it to the limitations of C2. It's really sad to think that we cannot create good physics based games with the provided tools, whether it's C2 or Box2D's fault, or even my own for the lack of knowledge.

    Thank you again for the great example you made earlier, I really do believe it's the best that can be done with the tools provided.

  • I finally got around to do this again since my last try a few weeks back.

    Your example was quite helpful and I did manage to make it work with SVG polygon, but it's a bit buggy. First dot goes to x0y0, SVG coordinates are flipped vertically, and ball has no friction, but with a bit of tweaking it might be fixed.

    Anyway, I was thinking about what you said earlier about the Canvas plugin. Is there a way to feed raw data into it? I found an extension for Adobe Illustrator called Drawscript that can output quite a lot. E.g.:

    fill(255,255,255);
    strokeWeight(1);
    stroke(0,0,0);
    bezier(661,508,663,506,671,508,671,508);
    line(671,508,671,518);
    line(671,518,661,518);
    bezier(661,518,661,518,660,511,661,508);
    [/code:1gdyzmfv]
    
    I guess making some sort of parser with events could read this code, but just wondering if there's something build into the plugin.
    
    I'm also not sure, is it possible to add physics to the Canvas or should another physics object be made that follows the Canvas path and draws the terrain?
    
    P.S. we need a feature like [youtube video="vlL-u9NxfOA"] integrated into C2, it'd make our lives so much easier...
  • How to use AdMob and IAP official plugins on Android-Crosswalk/XDK

    Though, the first step should probably be buying a Construct 2 Personal License

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The debugger gives an estimate, it is close, but not necessarily the correct amount of resources your game uses. Most often than not, the problem is CPU usage.

    The best way to test is export your game with Node (as NW.js if available on free version), run the game and monitor the CPU and RAM usage via Task Manager (on Windows). If you're developing for mobile you should test on that as well. Pretty much export and test on the actual device you're developing for.

    In general most modern tech have at least 1GHz CPU (I doubt C2 games utilize multiple cores) and 4GB of memory you might want to aim quite lower than that to make sure it runs great on any device.

NicotineLL's avatar

NicotineLL

Member since 4 Jan, 2015

Twitter
NicotineLL has 2 followers

Trophy Case

  • 9-Year Club
  • Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x2
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • Email Verified

Progress

15/44
How to earn trophies