Sumyjkl's Recent Forum Activity

  • Solved, see below posts

    I'm very confused.

    I have a layer with effects on it (sprites with multiply effect), but I need a way of "masking" where the effects are, either by saying where the effects can be, or a way of subtracting from the effects.

    In my capx, I have two layers. One is for objects, the other overlays effects. What I had hoped to do, and what didn't work, was to set the mask to Destination out, which in theory would subtract from the rest of the layer. The problem is it also subtracts from everything else in the layout. I've tried setting 'force own texture', but it of course only works when the layer is not transparent, which is really quite important.

    Anyone know how to get around this?

    Link to capx

    [Google Drive]

  • So I've been trying to create a multiplayer game, and with some success. Currently I have peers connecting to each other, a chat room with a couple commands, and a completely broken rest of the game.

    First I followed Multiplayer tutorial 4: real-time game and created a simple "you can move around and the other player sees it" game, and it worked! I made a multiplayer thing! So everything in the project to do with the player object and multiplayer is essentially identical to the tutorial.

    Anyway, after doing that I thought "the whole, [on peer connected] thing doesn't suit my game, since they're already connected in the lobby (chat room) and so it won't trigger when you go to the actual game, or more importantly, when a player dies".

    So I tried something.

    I disabled the normal method, because I was about to replace it elsewhere:

    And then I created a different method, on the host's side, for spawning an object for each peer:

    I thought a for loop would be perfect. It could cycle through each peer and assign an object to each one.

    The bit on the end is the debug method of determining what object is associated with each peer.

    It didn't work. On the peers' side, every object is associated with the host, because it was previously relying on [on peer connected] to get the Multiplayer.PeerID for when it was created:

    Having spent about 10 hours straight trying to work out a way to fix this, I feel like I've tried everything at this point.

    • Having the peers send a message to the host to create an object. This should mean the host would have a Multiplayer.PeerID to send to each peer other than it's own. It didn't work. For some reason, it still thought it was from the host.
    • Making player.peerID synced with peers. I can't see how this wouldn't work, but sure enough, same as before. In fact, I remember it doing other weird things, like having a blank peerID.
    • Having the host send a message with the UID of the object and the Multiplayer.PeerID to associate it with. Having explicitly asked it nicely not to, it somehow screwed it up.
    • Only spawning a single instance of the object, instead of the for loop, and then forcing it to associate with a single peer (with Multiplayer.PeerIDAt(1)). Again, no progress.

    So, is there a proper way to do it? Have I missed something? I need to be able to create new peer objects whenever I want, but at the moment it seems like [on peer connected] is the only viable option.

    Thank you so much if you have any advice!

  • Kyatric

    Thank you so much for the example.

    I ended up doing a similar workaround to yours.

  • I have been staring at my screen for a few hours now in disbelief at how enormously nonsensical the whole situation with text boxes is.

    First I found they steal mouse clicks, making an instance variable based "is focused" system totally impossible.

    Then I found they don't just steal focus for themselves, they steal focus for OTHER TEXT BOXES. So not even my ridiculous workaround that I thought would work, did.

    I really, really want to know. Is it actually possible, let alone plausible that one could ever find whether a text box is focused or not?

    Because seriously, it seems it would involve literal wizardry.

    Thank you, so goddamn much if you have anything whatsoever to help in my quest.

    TEXT BOXES NEED A GODDAMN "focus" BOOLEAN VARIABLE. NAO!

    /frustration

  • Probably best to do this:

    (Create a container with bat/eyes sprite)

    On bat eyes created  |  move to object bat (or other relative position)

                     |  pin to bat

    The problems I can see with your current method, for reference:

    ● [On collision with] triggers whenever something begins overlapping or is created overlapping another object, so it can happen multiple times (i.e. multiple bats can overlap and cause strange behavior)

    ● If the objects aren't in a container they can pick other instances. That is to say, bat1 can have bateyes2 pinned to it.

  • I've never used the multiplayer stuff before, but as for your first question:

    I take it your game works on the player(s) touching their player character to move it. If this is the case, the way to make it work for four people is pretty simple.

    For local multiplayer with multi-touch, you need:

    • A system to differentiate between several touches (keeping track of them)
    • A way to keep this tied with each player

    I always like to think that if you do everything with correct programming logic, and make any situation possible, most of these sort of difficult-looking things automatically happen. That is, if your game already differentiates between touches, you've got your game. Since the game can't differentiate between players (same device, and the device doesn't know who touched the screen) the only issue is keeping track of the touches and which character they belong to.

    In a bit more detail, you need the dragging and dropping part of the program to recognize the difference between touches.

    In pseudo code:

    on touch | store touch index in the object

    for each touch | do drag and drop events

    on release, find the object with the touch index that was released | reset the variable (e.g. to -1)

    Hope that helps. I don't have much experience with the touch behavior, but it should work.

  • Can you be more specific?

    If you follow this guide it may help.

    Edit:

    This is the system I usually use for menu buttons, if that is what you're asking:

    (reference is a text instance variable by the way)

  • You mean like this?

    https://www.scirra.com/forum/keep-momentum-and-same-time-ignore-input-while-jumping_t128458

    https://www.scirra.com/forum/how-do-i-disable-controls-input-while-jumping_t123872

    Edit: You might also want to decrease deceleration when doing this, else you'll slow down mid-air. That or decrease both deceleration (passive slowing for when you're not pressing movement keys) and acceleration (when you press keys).

    The trouble is, once you take this method you'll need to set a variable to reset to (unless this is the only time you use acceleration and deceleration).

  • Is there some other part of the project that changes that variable?

    Edit: sample capx http://www.mediafire.com/download/d70kn ... utton.capx

  • Berserky

    Not usually, but I don't think anyone actually knows why any more. Now that we have notifications on almost every forum in existence, it shouldn't matter.

    I would actually really like to see someone make something interesting with this. The limitations are such that it's totally useless as actual 3D (no textures or even colors for that matter) but it might make for some interesting project at some point.

    If you or anyone else makes a project I'd love to see what it's like.

  • Pretty sure it's in there. It's a system value.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oops, sorry, I misunderstood I think.

    I'm pretty sure the existence of multiple images in a sprite can affect memory usage, but I'm not sure if canvas2d optimizes this by leaving unused animations out of storage. It might be best to test this. Maybe use both types in extreme amounts and see what the difference is in memory use. Node Webkit is likely best for this, since browsers are not exactly stable.

    Other post:

    Not sure how canvas2d does it's thing, and I don't know much about the technical side of memory to begin with, but speaking logically; If the single sprite contains less data than the many, it's probably more effective. If it contains the same amount of data, it's less effective in principle, since the location and other information has to be stored about the object, not just the image. Transparency also causes much more of an impact in CPU usage on several overlapping sprites than on one sprite. My advice is that if it's plausible and a one off thing and the sprites would always be together, (the individual sprites aren't used in different configurations or anything) then it might be best to optimize there, and make it one sprite. If it recurs enough and often enough that all these sprites have to move in unison, it's probably best to optimize it as above.

Sumyjkl's avatar

Sumyjkl

Member since 16 Mar, 2014

None one is following Sumyjkl yet!

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies