R0J0hound's Recent Forum Activity

  • According to this:

    developer.mozilla.org/en-US/docs/Glossary/Origin

    Two pages share the same local storage if their origin is the same.

    So while beta.myawesomegame.com and stable.myawesomegame.com don't work since they are considered different origins, you should be able to do myawesomegame.com and myawesomegame.com/beta or something like that and it should work.

  • Well, according to this:

    javascript.info/localstorage

    localStorage is per domain, but you can't access other site's localStorage.

    So I'd guess that means if the first game was on a website like:

    http://www.myawesomegame.com/game1/main.html

    and the second was on:

    http://www.myawesomegame.com/game2/main.html

    Then they would have the same localStorage. Would have to test, but I never upload games online so I don't know for sure.

    Now, I don't know how construct handles that internally. They could be somehow making it unique per game and not shared.

    You could do it manually with js to cut out the middle man to see what happens:

    // to set value
    localStorage.setItem('key1', 1337);
    
    // to get value
    localStorage.getItem('key1')

    Why can't it be that simple in Construct? They seem to prefer triggers.

  • antigenmx

    Probably better to ask in the topic where I originally posted it. I don’t recall it.

    Also It’s not a relevant question to this topic. Kind of bad form to hijack a topic like that. By tagging someone they well see it no matter where it is.

  • Ah, the issue was how i was doing the keyboard stuff. The joy variables were being set in the key triggers but they'd be 0 by the time the move event came up so it wouldn't move.

    Anyways here's the working version:

    ucad12df0a367fdf64e6bfd23db7.dl.dropboxusercontent.com/cd/0/get/CiH8RhgwG23gXhoC9M8y-oR8rQ_yNfmRioqjPjubZNS_tp837FxnNj4xxHAJJk2nX1e26-M26SVcXNdJgPlaJQmRga5ykaaCogQ8NJEYQjBSxe1pBBASD5JaOnbFeI3rOGAt6kZWHDfICjdv0fYfBPnd/file

    Edit:

    You can tune it a bit by changing the /1000. I picked that so the perpendicular distance had a low influence. You can set it lower to make it affect it more.

  • I think I need to actually test it to see what’s up. Sorry about that.

    One thing that comes to mind is maybe you should move the selection to the closest dot in every tick. It may not be exactly on it since pin is delayed a frame.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Seems like an interesting problem. Thanks for everyone for the examples. It took me a bit to realize what they did since I’m on my phone.

    Here’s my event based solution. The first part is just for input, the last event is the meat.

    First it skips the dot the cursor is on.

    Next it picks all the dots in a cone in the direction pressed.

    Then it utilizes “for each ordered” to sort them by distance. It would be the same as “pick closest” but it also adds a fraction of the perpendicular distance so it prefers the dots closer to the direction pressed as opposed to just one of them when they are all the same distance away.

    variable joyx=0
    variable joyy=0
    variable dir=0
    variable move=false
    
    every tick
    -- set move to true
    -- set joyx to 0
    -- set joyy to 0
    
    on left pressed
    -- add -1 to joyx
    
    on right pressed
    -- add 1 to joyx
    
    on up pressed
    -- add -1 to joyy
    
    on down pressed
    -- add 1 to joyy
    
    compare: abs(joyx)+abs(joyy)=0
    -- set move to false
    else
    -- set dir to angle(0,0,joyx,joyy)
    
    move is true
    pick dot by evaluate: dot.x<>cursor.x & dot.y<>cursor.y
    pick dot by evaluate: 45>anglediff(dir, angle(cursor.x, cursor.y, dot.x, dot.y))
    for each dot ordered by distance(cursor.x, cursor.y, dot.x, dot.y) + abs(cos(dir+90)*(dot.x-cursor.x)+sin(dir+90)*(dot.y-cursor.y))/1000 ascending
    -- stop loop
    -- cursor: set position to dot
  • You do not have permission to view this post

  • The code only does the one rotation. You’d have to add code to rotate a tilt.

  • Probably replace 1024 with 1025 but I haven’t tested it.

  • I don’t have time to work on such a thing. Seems like the kind of thing independent of the cloth sim. I mean in something from scratch can you attach a sprite to another sprite?

    Also the zorder is completely subjective with this cloth sim. Make it 3D and there would be an order but I’m taking a step away from this for a while.

  • Hi,

    That plug-in hasn’t been ported unfortunately. Aside from my low interest in making plugins and barely using C3, I simply don’t have a lot of time to dedicate to doing much coding at all.

  • Here is a more generic version.

    1. Place the cloth sprites wherever you want some cloth. It supports multiple instances.

    2. change the instance variables of the cloth sprite to change up the settings.

    a. resX, resY is the size of the grid that you want to simulate. bigger sizes are slower.

    b. diagonals turns on diagonal constraints. Makes cloth a bit stiffer.

    c. iterations will make the cloth less stretchy the higher it is. 1 is the default and fastest. More than 10 would be very stiff but very slow.

    uc40e852c3f2e0a19d1821a1673a.dl.dropboxusercontent.com/cd/0/get/CiFOOpYVOrJFvbRlepzhOcoqdTMGPfdWvXrxr5mdUzQ6U4ZKj85treaqsrWDg9XdZVMNUU5AZ9_2pQYCFRAKJ0U6QEeBmBUzYbqFQ9TqJ95sLNUGazgxLZFgR6yIQOF0gWsgiuRzDzfT9_Mo-ImXiqTU/file

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound