Myrmex's Forum Posts

  • When it comes to dumb or routine actions you'll probably want to find a way to automate it. In this case it's possible with just a single card - on the trigger let application create instances for each card and apply individual variables to them in same event and then just set images according to these variables.

    Check this capx.

    I've added only 4 images, it must work with any animation named in deck array.

  • Just found out about "Set from JSON" action to determine object's state but couldn't get any documentation or explanations. Can it be used to assign variables only?

  • Pin additionable hitboxes like these which is quite reliable with simple objects or use formulas to calculate relative posotion of projectile right before collision.

    colX = object.X - projectile.X

    colY = object.Y - projectile.Y

    If colX > 0 & colY < 0 & colX > colY then it was hit from left

    If colX > 0 & colY < 0 & colX < colY then it got the bottom and etc.

  • So you move a card from the deck to a destination where it is revealed as random. Then there are few ways to do it:

    • Create separate sprites with individual face and init cover animations for each card, create an object "DECK" and use it as container for each of them so they are all spawned at once and at same image point. By shuffling Z order you'll get a lot of cards on top of each other and you can drag them without destroying, just swap cover to face when it's overlapping placement zone. It's even more convenient if you plan to have two or more decks on layout, but not the best solution because all cards will be on screen simultaneously causing theoretical lags. On the other hand it may provide you extra gameplay features.

    • Use single sprite with many frames which are picked via array. Initial array should contain, for example, 52 items with value 1 which means all cards are present. When a card is drawn - a random item with value 1 is chosen and set to 0. By inverting the array you may find what cards are on another side. If you are using animations - then dictionaries are more preferable since you are referring to animation names as strings.

    • Here's also a lazy way to manage cards - just upload all images to the project and have two arrays with their names as values, initial one with everything in it and second, empty on start, where you'll transfer picked items. Use instances of single sprite with only cover image. Whenewer a card is drawn - assign random picture to it via "Load image from url" action using array.at(floor(random(array.count))) & ".png", then pop it in first array and add to second.

  • Can't tell a solution of the current algorithm, but you may try this as alternative, works pretty smooth:

  • Hello. I have a family class containing about 50 instance variables and several dictionaries with accordable pairs "variable name":"value".

    I could create a function to manually apply each variable with 50 single actions, but that's very consuming, inconvenient and may cause errors, i.e. if I change family variable name and forget to fix key string.

    Is there any way to transfer data from a dictionary, array or maybe JSON string automatically? Like "for each variable" action or something.

    Here's example of what I need:

  • >99Instances2Go

    Worked like magic! Can it really be that easy?

    >plinkie

    That would solve, but every sprite has own origin and calculating relative coordinate for each is quite painful.

    Many thanks, everyone!

  • Drag'n'Drop is most smooth one with collisions. Tried following cursor, but there are own issues.

    Sorry for the size, forum doesn't support spoilers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello. I had this problem throughout many projects but now I can't evade it.

    When an object is attached to another object via everytickish positioning and you drag it around - everything seems fine until you restrict parent object's move area. On the GIF below you may see how square can't pass the border but connected sprites keep following cursor even though Mouse.X isn't mentioned in event sheet. Sprites go back to parent eventually (in few ticks or more) but then they go to it's "ghost" position again. I assume some engine limitations, but still hope for a solution.

    What I CANNOT do:

    • Apply pin behavior: I'm building kind of puppet rig with many parts connected and pin isn't compatible with many types of moving and rotating I'm using;
    • Restrict coordinates for each part in particular: there are reeeally lot of them and their origins aren't static.
  • [quote:xww8chsu]Every x seconds uses the wallclocktime, which starts counting when the game is started..

    So whenever I activate that function - it's already started?

    I mean, if there's "every 5 seconds" event which gets greenlight 2 seconds after beginning of layout - that doesn't really matter because I've spent unknown amount of time in the menu? Geez, I wish I knew that before I screwed my mind. Thank you for explanation.

  • >LittleStain

    Oh, forgot about that behaviour. I've linked main event to timer's loop and notes appear at the right moment now. Thank you

    Still, I don't get why it was so random earlier. Does "Every X seconds" event use another less precise algorythm? Should I ever use it then?

    edit: By the way, is there any delay between loops of timer behaviour? It feels like rhythm began to go off slightly.

    jojoe

    Can I use dt outside of "Every tick" event?

  • Hello. I'm doing some rhythm game where timing is very essential but I haven't used to Construct 2 engine yet, so here is the technical issue that bothers me:

    Music starts right after the layout is loaded, then I use "Wait" function to catch up with beat (i.e. 4 secs). After some time passes I change the variable that activates "Every 8 seconds" loop to spawn sequence of notes every 8 beats. So I expect it to start after 12 seconds and when I run this layout from the constructor (in browser) - rhythm is just perfect. But! If I start from previous layout and go to playable layout from menu - timer goes off 1-2 seconds sooner. If I build ".exe" and try it again - timer ends almost 4-5 seconds sooner. There was a bug that began notes' spawn few seconds later but I forgot how to repeat it. Anyway, these timings are terribly random and nothing good for gameplay.

    Are there any specifics of engine I don't consider or should I use some other actions for synchronizing? Thank you.

  • Also, there are object's coordinates in conditions, so problem can be in private variables. Actually, there are two different sprites on screen with their own paths, but for computer it's one object. Anyway, when I deleted one of clones, other one didn't work. Maybe, they don't take exact position, and, for example, there is x=200.01 instead of x=200.00? Can it be fixed? (link in previous post)

  • I decided to use RTS, cause it's easier to edit coordinates and make additional waypoints in any place, and with private variables I can use one object many times. But there is still trouble with order of actions. I made a sample with two variants of it, but neither of them works. I'm afraid, that I simply don't understand something in Scirra, could you fix my sample please? An Important thing, that actions should be linked to each other directly. In other words, bot goes to the next task, only after ending previous (reaching the point, waiting and etc.).

    <file>

    (sometimes there appear two sprites instead of one, that's a glitch)

  • Well, that's what I need. Private variables look pretty simple. Thank you very much.