Arima's Forum Posts

  • The simplest manner would be to have something like two lines, one that is updated if the line does not overlap anything, then another line at 50% opacity that is placed between the two points every time.

    Aside from that, I'm not sure what you want to do. Have it be pushed out? Have it be rotated out? Only update the position of each point if the line is not overlapping anything?

  • Please stick to English on the forums or provide a translation, thanks!

  • I'm not sure if c2 supports cocoonjs's new physics acceleration yet or not. Have you tried the demo that comes with the launcher?

  • Oh duh, yeah, that's a better idea. :)

  • Even though it's not a game, you're still limited in the same way games are, which is why games came up with the techniques they did to work within those limitations.

    The only idea I've got is upon switching pages, perhaps using the iframe plugin to navigate to another web page which contains another image/c2 app will unload the previous from memory. I'm not sure if cocoonjs supports the iframe plugin though, so if it doesn't you can try one of the other solutions out there, such as appmobi or phonegap.

  • Ahh, that might explain the weird behavior I've been having with my ui. At a guess, it might have something to do with the canvas being resized to full screen at start and so returning a value from before the resize? Not sure exactly...

    I've been getting around it by running the ui placement code for a few ticks before deactivating the group.

  • Whoops - I stand corrected. Sorry about giving out incorrect info, and thanks Ashley for pointing that out.

  • I'm not sure about the math, bust at a glance, use viewportbottom instead. Windowheight grabs the height of the whole window, rather than just the windows's content.

  • It's actually not strange - if there is at least one instance selected, the aces will keep running. If you have one instance in the layout, that is the max pickedcount can return. If you have 10 instances, at the start of the event sheet it will return 10 instead.

    If you have an example of code you want explained, post it and I'll explain what it's doing.

  • Hmm... Maybe it's safari unloading the textures on it's own. Browsers have their own memory management.

    Global means the object is not destroyed when switching layouts. You need to go to the layout it's on first, or create it in the layout instead. You'll probably still have the problem if you destroy all instances of it at any point. There must always be an instance of it somewhere, even if it's invisible, or you're going to have a pause when loading the textures when creating an instance again.

  • Mipey's right. If you do something like:

    If sprite is visible

    If sprite.pickedcount = 0

    Then if no sprites are visible, c2 stops running the event after 'if sprite is visible' returns false and proceeds to the next event, not even getting to the second condition. There are no situations where the sol has 0 picked instances of something and c2 continues running aces. You're thinking about it backwards - c2 doesn't start with no instances picked - it starts with ALL of them picked, then whittles the list down.

    To find out if no objects meet a criteria, I have an event that checks, for example, if an object is visible - then an else event after it, which only runs if the above event didn't run, meaning none are visible.

  • Are you using webgl? If so, c2 is using layout-by-layout loading - meaning anything not in the layout is dumped from memory. When you create an instance, it needs to be loaded again - resulting in a pause while it does so.

    To eliminate the pause, either keep it in the game as a global object or create an instance at the beginning of the layout and keep it invisible instead.

    I haven't tried it yet, but c2 also might not unload the sprite from memory when there are no instances if it was in the layout at from the start at edit time. That's just a thought though, I don't know if it's the case.

  • I updated it a bit with some more info and put it in the tutorials section: http://www.scirra.com/tutorials/418/for-each-tutorial

  • Correct, spread values is not required, but a lot of the time for each is not required either. For example, if you have the action "set sprite variable to sprite.x" without any loops c2 will set each instance's variable to that instance's x value.

    I wrote a tutorial a while ago about it here. I should update it a bit and put it in the c2 tutorials section...

    Edit: updated version with new info: http://www.scirra.com/tutorials/418/for-each-tutorial

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think it's already implemented, but requires webgl. I recall reading something about ludei possibly implementing support for it in cocoonjs even without webgl, though.

    I'm not sure of the specifics, though - like if using it swaps images in and out of vram but still requires the images to be stored in ram or if they're read from disk when swapping instead.