ID based doors and switchs.

For questions about using Classic.

Post » Sat May 14, 2011 1:27 am

DoorID and SwitchID should be tie together as well as the color of the switch. So, Blue SwitchID (1) shold open Blue DoorID (1), Blue SwitchID (2) shold open Blue DoorID (2), Blue SwitchID (3) shold open Blue DoorID (3), and so on.

However, it doesn't appear to work. I tired a For Each and Containers, non of which seems to work. It worsk for the first two, but not the others.
http://www.mediafire.com/?r5lhjth2smjcwa4
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Sat May 14, 2011 10:51 am

A few things in your cap seem a little long-winded. It's best in my opinion to use the function object, define clear functions like "Open Door" and call them passing the according parameters. That way you'll end up with a very clean setup.

To fix your cap quickly, you could just merge events 2 and 3 of the gimmicks sheet into one event that makes more sense. Basically it would look like this:


Now there shouldn't be any more picking confusion and the right doors will open.

Other than that I noticed you move your doors by simply adding +X to the position, without applying Timedelta. This will result in different door opening speed on different systems. You don't want that.

Also instead of comparing the animation frame paired with a trigger once condition, you could just use the "On any animation finished" condition. In theory it's better in case there are multiple doors on the same frame at the same time. Don't forget to uncheck the loop property of the animations for this to work.

A word of advice on a different matter: if you want people to look into your cap, try to get rid of custom plugins/effects if they're not necessary for the problem at hand. Or at the very least mention and link the custom plugins needed to open your cap.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat May 14, 2011 12:03 pm

Wouldn't timedelta make things slower?
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Sat May 14, 2011 12:22 pm

Time scale make things slower (or faster). With timedelta, things moving at the same speed, even at lower framerates. Just search "timedelta", its already explained, how it works.

edit: viewtopic.php?f=3&t=9192&p=72246&hilit=timedelta
scroll down to Tulamides post.
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat May 14, 2011 4:02 pm

[quote="Azu":hxi0qs04]Wouldn't timedelta make things slower?[/quote:hxi0qs04]

Azu.... come one man! :P

You've been a member since 2007, I think it's time to learn what timeDelta does and how to use it :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat May 14, 2011 4:22 pm

I tired it and I really don't like it. I tired Door.Y-0.25*timedelta and it move super slow, like 0.25 every second. I had to do like Door.Y-100*timedelta. I'm not use to using big numbers. I really know nothing about timedelta because I never used it.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Sat May 14, 2011 4:59 pm

[quote="Azu":8wxmuebz]I tired it and I really don't like it. I tired Door.Y-0.25*timedelta and it move super slow, like 0.25 every second. I had to do like Door.Y-100*timedelta. I'm not use to using big numbers. I really know nothing about timedelta because I never used it.[/quote:8wxmuebz]

0.25*Timedelta means it moves 0.25 pixels every second. Yes, that would be quite slow. And 100*Timedelta means that the object would move 100 pixels per second on that speed. It's just a matter of thinking in pixels per second when it comes to movement speed I guess.

There's also a nice little example on the We Construct blog, which deals with TimeDelta to create a custom timer. Maybe that will help you understand. Also it's never the wrong idea to revisit the wiki article.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat May 14, 2011 5:24 pm

[quote="Azu":1ml7mrq6]I tired it and I really don't like it. I tired Door.Y-0.25*timedelta and it move super slow, like 0.25 every second. I had to do like Door.Y-100*timedelta. I'm not use to using big numbers. I really know nothing about timedelta because I never used it.[/quote:1ml7mrq6]

No, no, use Door.Y-(100*timedelta).
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat May 14, 2011 6:18 pm

[quote="Arima":3tmazibc]No, no, use Door.Y-(100*timedelta).[/quote:3tmazibc]
I may misunderstand this, but if you mean the parentheses I should say that they are not needed in the example. Construct follows the mathematical rules of order for arithmetic operations. Multiplication and division has higher priority than addition and substraction.

Door.Y - 100 * TimeDelta
Door.Y - TimeDelta * 100
Door.Y - (100 * TimeDelta)

All three do exactly the same. First multiplying 100 with TimeDelta (or TimeDelta with 100, which doesn't make a difference in multiplication), then substracting the result from Door.Y.


[quote="Azu":3tmazibc]I tired it and I really don't like it. I tired Door.Y-0.25*timedelta and it move super slow, like 0.25 every second. I had to do like Door.Y-100*timedelta. I'm not use to using big numbers. I really know nothing about timedelta because I never used it.[/quote:3tmazibc]
Like PixelRebirth said, don't think in fractions but in the resulting period. If you aim for your game to run at 60 fps and add 1 pixel per frame, then the effective pixel rate is 60 * 1 = 60 pixels per second. And value * TimeDelta simply means "that much of value per second" (and Construct cares about how much of that needs to be used per frame). So, when your game would run constantly with 60 fps, then

[code:3tmazibc]+Always
-> Set x to x + 1[/code:3tmazibc]
and
[code:3tmazibc]+ Always
-> Set x to x + 60 * TimeDelta[/code:3tmazibc]
do the same. But if the framerate changes, then the second event makes sure, the speed is still constant 60 pixel per second.

TimeDelta is a number that expresses the time passed between the current and the last tick. On a system where there is constant 60 fps, TimeDelta will be 1/60 (or 0.016p) on every tick. Now multiply 60 with 0.016p. Yeah, it's 1, just as wanted and expected.

Of course, TimeDelta serves as an indicator for all changes and hickups in the framerate, not only a constant change. And that's what makes it so flexible and guarantees a constant line of whatever you need (movement, speed, rotation, color fade, etc.) over time, by using higher or lower portions per frame to compensate.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat May 14, 2011 6:38 pm

Whoops. Well then, good to know!
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests