While Loop

Discussion and feedback on Construct 2

Post » Mon Nov 07, 2011 5:19 pm

As far as I know, there is no while loop for Construct 2. Is there any chance this can be implemented in a future release? Or is there a tutorial or some easy way to make a while loop using the loops given?
B
40
S
8
G
6
Posts: 61
Reputation: 5,951

Post » Mon Nov 07, 2011 5:23 pm

I mean you can make it using "variables" like boolean (true/false) variables. Make a condition where your "while" can not meet the circumstances and them make it change the conditional for "false", also, make it check in the begin if the conditional is true.
ImageImageImageImageImageImage
B
93
S
20
G
14
Posts: 1,218
Reputation: 19,500

Post » Mon Nov 07, 2011 5:47 pm

I've done something like that before, but I just wanted to say that it would be loads easier (and code space saving) if there just was an event for it.
B
40
S
8
G
6
Posts: 61
Reputation: 5,951

Post » Thu Dec 01, 2011 8:33 pm

[QUOTE=TELLES0808] I mean you can make it using "variables" like boolean (true/false) variables. Make a condition where your "while" can not meet the circumstances and them make it change the conditional for "false", also, make it check in the begin if the conditional is true.[/QUOTE]

I need to fake a while loop and am having trouble figuring out what this means. Can anyone put this in terms of construct?

Edit: here is what I'm trying to do, since C2 hasn't added AngleDiff yet: http://gmc.yoyogames.com/index.php?showtopic=386952dustingunn2011-12-01 20:37:15
B
4
G
6
Posts: 32
Reputation: 1,514

Post » Thu Dec 01, 2011 9:11 pm

@dustingunn: I'm not really sure what that script does.
From the description, it returns the smallest angle between two, right ?

Couldn't you achieve the same thing with the min() expression ?

Anyway, about while, the workaround doesn't seem to apply there, since you need the while loop to be executed in that specific tick, not over several ticks.
(FakeWhile.capx)

Maybe the branch plugin could be of help there (check out the plugins for C2 forum).
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Thu Dec 01, 2011 9:20 pm

No, it returns the difference between angles while accounting for 359 and 5 being only different by 6, for example.

Construct 1 had a very useful system command called "AngleDiff" which handled this but it's not in 2 (yet?)
B
4
G
6
Posts: 32
Reputation: 1,514

Post » Thu Dec 01, 2011 9:23 pm

Yet probably.
@Ashley has a huge to-do list. Some items find their way onto it, some already are there but will take more time before geting implemented into C2.
It is a matter of time and priority.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Thu Dec 01, 2011 9:52 pm

You can do angleDiff with this expression:
a is first angle
b is second angle
AngleDiff = acos(clamp(cos(a)*cos(b)+sin(a)*sin(b), -1, 1))
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests