winkr7
Turns out you were right, it runs the next tick. Guess looping backwards over the list works to do that.
waitlist = [] time = 0 function wait(t){ waitlist.append({when:time+t, events:followingEvents}) } while(gameRunning){ time += dt run(eventsheet) for(i=waitlist.length-1; i>0; --i){ if(waitlist[i].when<=time){ run(waitlist[i].events) waitlist.remove(i) } } }
Not sure. We could test that with something like this:
Star of layout — set text to tickcount — wait 0 seconds — set text to self.text&tickcount — wait 0 seconds — set text to self.text&tickcount
Depending on how wait is implemented we could get 000 or 001.
Edit: I’m inclined to think it would be 000, aka all wait 0 after a wait will be run. The logic may be similar to the following. If I wanted it to delay to next frame it would be more complex I’d imagine. We could always look at the c2 source to see how wait is implemented too.
waitlist = [] time = 0 function wait(t){ waitlist.append({when:time+t, events:followingEvents}) } while(gameRunning){ time += dt runEvents() for(i=0; i<waitlist.length; ++i){ if(waitlist[i].when<=time){ run(waitlist[i].events) waitlist.remove(i) i-=1 } } }
It probably works like this, at least that’s how I rely on it working.
Update loop
— run event sheet
— run wait events that are done
Here is a way to rotate around any point. Set cx,cy to the point you want to rotate around, and set a to the amount to rotate.
var a=1 var cx=100 var cy=100 rotate a degrees set position to (self.x-cx)*cos(a)-(self.y-cy)*sin(a)+cx, (self.x-cx)*sin(a)+(self.y-cy)*cos(a)+cy
Here is an alternate way. It checks the value with all the other values and if any match it randomizes the number again and re-does the check.
dropbox.com/s/z0an316nusgc6nu/unique_random_list.capx
If you were only concerned with the values 1 through 6 you could do something simpler like this too.
dropbox.com/s/mb9he4ke03d7r23/unique_random_list2.capx
sir lolz
Not with this plugin. The paster plugin supports that.
You have to loop over the array backwards.
Var i=0 Var count= Array.width Repeat count times — set i to count-loopindex-1 — array.at(i) == 0 — — remove array at index i
Or you can
Var i=0 Every tick — set i to 0 While i<array.width — array.at(i) == 0 — — remove index i — — subtract 1 from I — add 1 to i
Develop games in your browser. Powerful, performant & highly capable.
Idk, using a wave collapse function doesn't seem to keep everything connected.
Here's an experiment with it. I don't think I provided enough tile cases since it can't resolve a few tiles. It was interesting to mess around with though. It probably could be made to erase those dead ends to try again. It would also be nice to give some tiles more weight than others.
dropbox.com/s/grb9i41yhpy8uhp/waveFunctionCollapse.capx
First you find an equation to get the circle that goes through the three points, and then there was some extra math to transition from one angle to the other to plot points on the arc.
dropbox.com/s/rwk6kjs9brx8myr/arc_through_3_points.capx
Probably can do it with a maze generating algorithm. Or something like that.
en.m.wikipedia.org/wiki/Maze_generation_algorithm
Edit:
One possible way using prim's algo.
dropbox.com/s/58l1kqgcdlse96x/primsAlgo.capx
It’s a special thing. There are many ways to do it.
Here’s one possible way.
construct.net/en/forum/construct-2/how-do-i-18/resize-handles-example-48892
Oops. I’ll need to fix that and reupload. You’d add it to the velocity update event.
Set vx to (self.x-self.px)/step*damping
Set vy to (self.y-self.py)/step*damping
Let me know if there are any other features needed.
Member since 15 Jun, 2009