nusbaumc's Recent Forum Activity

  • I ran into this problem recently myself.. had my project up to 750 MB. It builds up a complex, but static, image using really big (600x600) stacked layers, each with one sprite on it.

    What I did was instead of having every possible image be a different animation, and thus always be loaded into video memory, each part of the image had 1 frame that was loaded from the server (via Load Image from URL) when needed. I wrote a preloader (actually, a PHP script that generates a preloader, but I digress...) that I plugged into the index.html that Construct 2 generates when you export your project and now it still works just fine but only uses 35 MB of video memory.

    So.. the moral I guess is if you're using too much memory there's ways you can work around it. Most laptops and desktops won't really care until you get up over 500 MB. I haven't done anything for mobile yet but I know they have a lot less RAM in general.. you need to think about memory management from the beginning.

  • I don't use the built-in behaviors, so this is how I would do it.

    One way to write the wave equation is:

    D(x,t) = A sin(kx - wt + [theta])

    where w = 2(pi)f

    D is the displacement from the center, k is the spring constant, x is the x position on the wave, w is [2*pi*f], f is the frequency, t is the time, and theta is the phase angle.

    Since we're only concerned with one spot on the wave and not the entire thing we can let theta be zero and x be pi/2 (the maximum of a sin wave). However, if you had multiple objects you wanted to randomly wave together but not in perfect sync the easiest way to accomplish this would be by playing with the phase angle.

    Now, for the behavior you asked for, I think the easiest approach would be to vary the spring constant k and not the time t. All you would need to do is solve the wave equation on every frame (remember to use a proper delta-time value and calculate the current time rather than just counting frames) and move your object to whatever displacement you come up with. When you want to change how fast it's moving you can change the spring constant k value (which isn't so constant in this case....) and it'll start moving at the new speed on its own.

  • I have some radio-style buttons in my current project. The absolute easiest way is, in psuedo-code

    function onButtonClick

    • all buttons Set unchecked

    button0 -> onClick

    • Function.Call("onButtonClick")
    • button0 set checked
    • radio variable - set 0

    button1 -> onClick

    • Function.Call("onButtonClick")
    • button1 set checked
    • radio variable - set 1

    etc

  • You can't put an iframe inside an HTML canvas element. You can absolutely position a div element over the canvas but this is hacky and would require a plugin of some sort to work with Construct 2. Loading your data via Ajax and having a separate layout for your leaderboard would be a lot simpler.

  • You can load sprite images from a URL.. that's about it but if your images are static that's enough. Storing them permanently isn't possible though without jumping through some crazy hoops (like writing a custom plugin)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To be honest I've been kicking around the idea of making a plugin that clones most of RM2K3's functionality, including its resource formats. RPGMaker is so much better for making RPGs than Construct it's silly but the executable is Windows-only, even in the newer versions.

  • OK I just spent like 3 days figuring this out.. so.. here goes!

    You take a screenshot with CanvasSnapshot. You already know that. My chrome bugs out if I try to use the snapshot on the same frame it was generated so I put a 0.1 second wait after it.

    You can take that screenshot and download it locally like in the example app. If you want to send it elsewhere, the CanvasSnapshot system expression contains a Base64 encoded PNG image prepended with the MIME type and set off the from the actual data with a comma. If you strip off the crap in the front and URLEncode the data you can send that via an Ajax POST action. You can do both of these in a single action; I set my post variable to ""imagedata=" & URLEncode(replace(CanvasSnapshot, "data:image/png;base64,", ""))" and just post that since I use GET parameters for everything else.

    On the server side, remember that PHP automatically URL decodes so you just need to do base64_decode on your POST data. Don't do a manual urldecode or you'll corrupt your data. Once you do all that you'll have your PNG screenshot data in PHP and you can do whatever you want with it.

    As for screenshotting certain things, all you can do in Construct is take a snapshot of the entire canvas. You can edit it in GD on the server side if you want to though to crop out what you don't want.

  • I got the "Else" working now. I was layering the events incorrectly as subevents of the subevents. Thanks for your help.

    Construct 2's logic is really weird if you're used to other languages but I have yet to find anything I can't do with a proper ordering of events and subevents. Seems like you already figured this one out though.

  • Are you a moron? Ajax will not sustain the server and it will fall. I do multiplayer and web socket.

    He's asking for login, chat, and high scores. None of that requires a constant connection, you can just poll the server with Ajax 30 seconds or so. It's fast and easy and suited for someone like the OP who obviously isn't versed in such things.

  • Thanks! If it's really that simple I'm going to kick myself in the rear later.

  • I'm bumpin' it again!

    If I don't hear something I'm going to assume it's just not possible and I'm going to have to stop being lazy and write a plugin for it!

  • You need to know PHP or some similar language. Put an Ajax object in your game and use it to talk to your PHP script. You can encode all your data into a query string and send it to the PHP side using an Ajax request. Your PHP script does whatever it does and sends some data back, which triggers an Ajax On completed event with the data your PHP script sent back appearing in the Ajax.LastData system expression. You can use the tokenat system expression to parse it and put it in your in-game variables.

nusbaumc's avatar

nusbaumc

Member since 17 Dec, 2013

None one is following nusbaumc yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies