Guizmus's Forum Posts

  • The the solution I described should work then.

    You should be able to update a variable in C2 from the webpage by looking into the runtime object, in a javascript debugger too though. C2 is running on the page, so you could change the variable there. But as this wouldn't trigger a function in C2, having an interface between the page and C2 is more versatile.

  • Can't provide a capx, it all depends on your API for the actual integration. Mostly, it would go something like this :

    capx organization

  • One simple thing you could do, if you don't want to write a plugin, would be to check every tick a variable in the page, or the result of a function in the page. You can call the ExecJS function inside a "System:Compare two values" for example.

    More detail example :

    I have in my page a function "A" that collects informations to be send to C2. Each time I have to send informations to C2, I call this function, it stores datas.

    I have another function "B" that displays this information in a string encoded how it fits me. When this function is called, the stack of informations to be send to C2 will be emptied.

    Now in C2, in an EveryTick event, I would start by setting a local variable to the result of the call to the function "B" via an ExecJS. Then, I would read this variable. Explode, JSON decode->put it in an array, whatever fits, and do a for each to treat every action.

  • I'm not exactly sure how you want your movement to be. I took a look in your capx and here are some remarks :

    • instead of positioning your upper part over the lower every tick, use the Pin behavior.
    • if I understand space type movement, you should do multiple bullets behavior. The first will be the "booster". The others will be the straffs. Pushing left and right would increase/decrease the power of the straffs, making it strife left and right. Pushing up would increase the speed.

    Here is a capx doing this. The angle jump isn't here anymore.

    capx

    EDIT : i added more details in the code. To be clear, the problem you had was that rotating the lower part 90? when the left / right was pushed made the ship do a clean 90? angle in space, strange. Straff is here to help simulate that. I think the better way though would be to go with the physic behavior, and apply forces on acceleration/deceleration and side pushes.

  • Just download the last beta from the bottom bar of the website, and then execute it. It will remove the old version, upgrading it directly.

  • I downloaded and tried your example. Not seeing the problem, I watch some levels of princess peach to understand, and played around it a little.

    What I tried is removing the "is jumping" condition, and use smaller margins top and bottom (in the events 8 and 9) to move the camera at the last possible time, to prevent too much scrolling.

    It's hard to tell what they put on top of that in the game though, some small layouts don't scroll at all, but most I've seen seems to be linear, quite horizontal.

    Only small problem I saw was sometime the camera moving then stopping, then moving again... with no deceleration. This can be solved with some lerping in the scroll actions (tutorial)

  • If I'm not mistaking, you spare the timer and use the "On animation end" condition, from the sprite object, to revert to default animation too.

  • philx

    Glad it helped. Once you get a hang on how functions and UID work (and work well together), C2 becomes a lot more... fluent ?

    I didn't see your capx so it's hard to tell, but if I had to keep track of the dead player, a variable on the spawner, as you said, seems like a good way to go too. You may just have had a little bug in the events.

  • AJAX is, is C2 or not, restricted by some rules, to protect the user. One of those rules is : no cross-domain. This means an AJAX request can only be for the same domain your game is stored on.

    If it is required to pull some information from another website, you can do it from the server, in PHP using CURL for example.

  • Let's call A = angle(center of the circle,mouse)

    Then you have the coordonates for your object with some trigonometry.

    X = cos(A)*D/2

    Y = sin(A)*D/2

    Where D is the diameter of the circle.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't take a look right now, I'll come back to it later.

    Using a container is usefull because :

    • if you pick an enemy in an event, you'll pick also the pixel, and the opposite way too
    • if you destroy / spawn one, the other will do the same. (you will have to have an event that, on enemy spawn, pins the enemy to the pixel though)

    Containers just says that one cannot exist without the other.

  • If you have access to families and use the solution I sent (only with 2 players, not hard to expand to 4), timer shouldn't be a problem.

    No you can't "observe" the change of a value. Instead, you can do a function "changeValue", that changes the value and calls another function if the value is now 0. Then, just always call this "changeValue" function instead of changing directly the value.

  • Could you share the .capx so we could take a look ? I'm not sure to understand right...

  • Nice if it helped :) And for the first solution, don't bother, I see you don't have the full edition for now so you don't have families anyway...

  • Well, the problem is the rotation and movement direction.

    One thing you could do is use another object for each enemy.

    This object would be a single invisible pixel. You would want to put this pixel in the same Container as the enemy, so each enemy has a pixel linked to him, and when an enemy is picked, the pixel is also picked.

    Then, you would have to have the pixel handling the pathfinding, and rotating, instead of the enemy. The enemy would only be pined to the pixel, without rotation. You still handle the rotation of the enemy sprite manually as you do right now. You will also have to transfer the movement function to the pixel, as he is now the one moving.

    So now that the pixel moves and not the enemy, if you have the line of sight on the pixel object, it will follow the rotation.

    After re-reading what I wrote, I may completly miss your problem, if I misunderstood how you handle the enemy rotation on screen. If that is the case, sharing your capx could help.