R0J0hound's Forum Posts

  • Best I can tell you just need initializeAsync to finish before calling any other functions.

    So in the “then” you could call a c2function and enable a group of events there. In that group you’d update the progress and when it’s 100% call startGameAsync. Only caveat to consider is if your game finishes loading before you enable that group. Probably a trigger once condition in the group comparing loading progress to 100 should do it.

    I don’t know if it is it’s own progress bar or what. It doesn’t seem to be a requirement before calling startGameAsync, but its pretty painless to just set progress to 100 before calling that.

  • If you use the browser object you can load the js library with

    $.getScript(url, callback)

    Callback is called when the library is loaded.

    I like to have it call a construct function when it’s done. So you’d place this instead of callback:

    function(){c2_callFunction('c2functionname')}

    So then when that function was called you can run basically the js you have in the script tag. Instead of the vars just call a different c2 function.

    In that c2 function you now know that everything should be loaded and you can access the stuff the vars in your events did.

    Set text to browser.execjs("FBInstant.player.getName()"

  • It probably is more involved than it appears at first glance. Mostly tedious.

    Layouts in capx files are in a xml format and if you add more layouts you’ll need to modify the project.xml in the capx to add it to the layout list.

    Modifying layout xml files instead of just creating them are more involved. Probably would require parsing the entire layout, and then you’d have to decide what to remove or add. A easier bet is to save everything from in game and just recreate a new layout xml.

    So you can still save your game in json or whatever but it will ultimately need to be recreated in xml in the format the construct2 uses. Save your game as a folder or open your capx as a zip file to see how these xml files are formatted. As an exercise see if you can duplicate an instance. Basically that’s all you’ll be doing to generate a layout, or rather that’s what a program will be doing.

    Anyways the basic flow is:

    1 save to a file from your running game.

    2. Close the capx in construct

    3. Take that file, generate the layout xml and insert it in the capx.

    The closest I’ve done before is to take a tiled file and create a layout.xml with a sprite per tile. This pre-dated the tilemap plugin. It was more of a one shot thing though, so I did a lot of it manually.

    It’s an interesting idea though.

  • I thought that last example capx I made was fixing it. It was for me at least. It bypasses how the textbox is positioned the next frame by instead positioning it directly.

    If that doesn’t work or it isn’t a usable solution then filing a bug report in the official way would be a good path to a solution.

  • Like I said above, it lags because they are positioned a frame behind. The reason is because the position is updated after the frame is drawn.

  • You can also set the strength of the motor. By default it will use up to an infinite force to make it turn. There’s an action to change the setting of a joint by tag. Use “” for the last created joint.

    I forget if there were other settings you could do for other joints. Guess you may need to refer to the chipmunk manual. This plugin is just a wrapper for the chipmunk library. There are things it can do that I’m not familiar with.

  • Instead of setting velocity have you tried adding a motor joint to yellow instead? Or maybe apply a torque if the angular velocity is too low.

    Physics engines don’t seem to like it when you set positions or velocities, but maybe Box2D can handle it better? My best guess why it’s different is the chipmunk library does things differently somehow.

    For best results the engine likes doing stuff with joints, forces and impulses.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you have your game working up to the point where you draw the lines and need to calculate the area? The solution is going to look different depending on the rest of your game.

    Here's my idea for such a game. There are other ways though.

    dropbox.com/s/y8oy7obmz5t4hqc/grid_game.capx

    Basically after each turn I do flood fills to find enclosed or open areas. It doesn't come out looking too simple.

  • Here is a quick fix you can use in your project. Event 2 to be specific. Just put it after whatever scroll events you have.

    dropbox.com/s/ymw2s6futtvpzm0/scroll_w_textbox_fix.capx

    I put red boxes under the textboxes as a visual test. With event 2 enabled you don't see the red boxes when scrolling. When disabled you see the issue you have.

    The only issue now is when the textboxes are half off the screen. That other capx should help with that but it's a problem for another day.

    cheers.

  • We can try to fix the bounce so it never ends up going horizontal. The original breakout only changed the angle the ball moved when it hit the paddle, otherwise the bounces were perfect.

    Here's a test of some ideas.

    dropbox.com/s/fubwui5edgzjep1/bounce_constrain.capx

    It has three on collision events. Only one should be enabled at a time.

    The first is probably what you're already doing. It uses the bounce action and sometimes the ball starts going very horizontal if a corner is hit. The issue case.

    The second one tries to fix the bounce angle to be perfectly mirrored or flipped from before the collision. It works mostly but when a corner is hit the ball can start going in the opposite direction.

    The third takes it a step further. Instead of fixing the bounce it will calculate the bounce itself. To do that it first backs the ball up until it's no longer in the wall and then uses overlap at offset to check if it's next to a horizontal or vertical wall.

  • By inside do you mean the gravity is always away from the center of the planet?

    If that's the case you can just reverse the objects in your expression like this:

    angle(gravity.X,gravity.Y,Player.x,Player.Y)

  • Hello,

    Since I made the paster plugin here are the two ways to install it.

    1. Just drag the c2addon file onto the c2 editor. It should tell you it installed.

    2. Rename the c2addon to a zip file. You can then get from it those four files:

    Runtime.js

    Edittime.js

    Common.js

    Icon.ico

    There are other files in there as well to make it work as c2addon file, but they are not needed to make it work.

    Anyways just make a folder named “paster” in “c:\program files\construct 2\exporters\html5\plugins” and copy those four files over.

    Also as a side note if you install via dragging and dropping the c2addon file the files will be put in a folder elsewhere within the c:\users directory somewhere. Just in case you wanted to look at the source later.

    Anyways, that should get you running with it. If you have any issues or questions about it feel free to ask in the paster topic. It has it’s share of issues but is still useful imo.

    Cheers

  • There’s the canvas recording with the “user media” plugin.

  • I meant since it’s c3 it’s more likely to get fixed.

    But a custom text input could be nice. It would give you more freedom to style it. Tedious, but gives more control.

    Btw here’s the capx I mentioned above. It was solving a different problem but may have useful bits.

    dropbox.com/s/iaunubjjay2b5ws/position_clip_dom.capx

    I was going to rant about construct quirks/bugs and website issues but eh. I’m just a casual user. Maybe they could hire a dedicated bug tester instead of just users that encounter bugs and go through the effort to report them.

  • It looks like it’s lagging a frame behind to me.

    As I recall, the order things run in construct is basically:

    1. Update plugins

    2. Run event sheet

    3. Draw

    4. Repeat

    The edit box’s position is probably updated in 1, so if you set the scroll position at all in events then it will take till the next frame to update the editbox’s position, hence the lag.

    Probably would make a nice bug report if you want to go that route.

    For a more immediate solution you can position the editboxes manually with events. I don’t mean the set position action though. I’m pretty sure that still won’t update the physical position till the next frame.

    Anyways you can try using some css to position it since there’s an action to apply some css to the object. I don’t know offhand which css to use but you should be able to find a list of them perhaps. Positions will be relative to the page instead of the layout so you’ll need to convert it with the layoutToCanvas expressions.

    A second idea is to use a bit of js. If you set the id property of the editboxes you can access it in js with document.getElementById(“id”).

    From there you’d need to look up the js properties exposed that you can use.

    I apologize it’s a bit vague. I did post a similar example capx once before, but I doubt I’d be able to find it while on my phone.

    Since this is in the C3 section, the easiest bet would be a bug report and hopefully it can be fixed in a timely manner.