The 'Real World Examples' Thread

Post your own tutorials, guides and demos.

Post » Sat Mar 28, 2009 4:38 pm

Pausing in Flash works the same way. I don't use Construct, because I'm waiting for the 1.0 release, but I do use Flash CS3, and I must say that I know no better way to pause a game than use a Boolean variable called "gamePaused" and a bunch of if statements. :roll: If someone knows a different approach, please, share your knowledge. As of right now, I just remove/disable event listeners when the game is paused and add/enable them again when the game is unpaused, but there are still some problems to overcome.
B
2
G
4
Posts: 71
Reputation: 1,192

Post » Sat Mar 28, 2009 4:48 pm

[quote="fantasyjam":15a1qrun]Pausing in Flash works the same way. I don't use Construct, because I'm waiting for the 1.0 release, but I do use Flash CS3, and I must say that I know no better way to pause a game than use a Boolean variable called "gamePaused" and a bunch of if statements. :roll: If someone knows a different approach, please, share your knowledge.[/quote:15a1qrun]
In Construct, just set the time scale to 0. Everything stops, events keep running. No need for loads of 'is paused' tests or enabling/disabling anything. Setting the time scale to 0 basically means 'stop time from passing'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Apr 14, 2009 6:16 pm

Timescale works for "going to eat dinner"-pauses. If you want to pause the game to view your inventory for example you would need to do it the hard way.

A sub-application plugin would come in handy in the future, i know it's used a lot in mmf. But it's not really nescessary since there are not to hard workarounds.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Tue Apr 14, 2009 6:30 pm

There's a layout plugin to run layouts in others.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed Apr 15, 2009 10:03 pm

WOW! awsome! Can you timescale one layout without affecting the others?
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Tue Apr 21, 2009 11:34 am

Example 02:

Portals

Objective: What if you want to create a Castlevania-like layout/portal system where you exit a layout to the right and want the player to spawn in the next layout on the left?

Info: If you go right or left to exit layouts, you run into an object that triggers a 'go to next layout' or a 'go to previous' layout command. Also, it sets a global variable that is being used for the upcoming spawn event.

Also, nod to the developers: If you turn the Transition to 'Fade', it completely breaks the system so that the spawns ain't working anymore - I still haven't figured out a solution for this. How do transitions work exactly?

Resource: www.thomasmahler.com/files/construct/portals_01.cap
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Tue Apr 21, 2009 11:56 am

Request:

Objective: How to make incremental and random variables.
Info: By incremental I mean something happening more and more often the longer time goes on, for example making an enemy spawn faster and faster throughout a level.
---
By random I mean giving something a random variable with upper and lower limits. For example an enemy spawns but you want it to have a constant walking speed of any number between 100 and 150.
Resource: No Idea how to do this, so no .cap I'm afraid.
B
2
G
3
Posts: 40
Reputation: 930

Post » Tue Apr 21, 2009 1:06 pm

[quote="Lemming":3dzuw2ql]Request:

Objective: How to make incremental and random variables.
Info: By incremental I mean something happening more and more often the longer time goes on, for example making an enemy spawn faster and faster throughout a level.
---
By random I mean giving something a random variable with upper and lower limits. For example an enemy spawns but you want it to have a constant walking speed of any number between 100 and 150.
Resource: No Idea how to do this, so no .cap I'm afraid.[/quote:3dzuw2ql]

For your first question, you could use the X coordinate of the player as part of the random generation equation. The further along the player is (assuimng completely that the player is travelling to the right) the higher his/her X coordinate will be.

You could do something like:
(pseudo code)
[code:3dzuw2ql]
+Every random(10000)+10000 milliseconds
+Player X is less than 200
+Player X is greater than 0
-Create enemy at X,Y
-Set enemy speed to random(100)+50
[/code:3dzuw2ql]
followed by
[code:3dzuw2ql]
+Every random(5000)+10000 milliseconds
+Player X is less than 400
+Player X is greater than 200
-Create enemy at X,Y
-Set enemy speed to random(200)+50
[/code:3dzuw2ql]

There are probably better ways to do this, as I'm quite sure people will point out... but I come from the "Quick and dirty and get it done" school, not the "Precise and correct and optimised" school.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Apr 21, 2009 2:27 pm

[quote="SoldjahBoy":2m601xij]
[code:2m601xij]
+Every random(5000)+10000 milliseconds
+Player X is less than 400
+Player X is greater than 200
-Create enemy at X,Y
-Set enemy speed to random(200)+50
[/code:2m601xij]
~Sol[/quote:2m601xij]

That sounds handy, what does the "random(x)+y" command do?
I'm going to assume it chooses a random number between 0 and x, then the +y is to set a lower limit, is that right?
B
2
G
3
Posts: 40
Reputation: 930

Post » Tue Apr 21, 2009 3:28 pm

That's correct.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

PreviousNext

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest