How do I do specific task to go to the next layout?

Just started using Construct 2? Post your questions here

Post » Mon Feb 09, 2015 11:41 pm

Hello. I'm still pretty new at this and was wondering how do I use multiple objective/task to move on to the next level/layout. The game I'm making is a math game (ikr) that you have to hit box that has a certain numbers on it to add/sub/multi/divide to get the correct answer in the end. Which makes you go it to the next level (going through the blue door ). When thinking about the way I can do this. It was way easier to just hit specific boxes to go to the next Lvl instead of just making the code count ur numbers to equal the right answer. Is there a plugin that can help me do this or if not. How do I write this in the events? This will help a lot. Thanks :D

Here is a picture of an example of a level and how to solve it to go to the next task. There isn't any boxes with numbers on it, because my teammates are still working on it.
Image
The blue arrows are where the player suppose to go for the right boxes and the door is the end point and will only open if they get the right boxes.
You do not have the required permissions to view the files attached to this post.
B
10
S
2
Posts: 25
Reputation: 670

Post » Tue Feb 10, 2015 5:30 am

This is a rough thought, but I wanted to give you some ideas. I'm typing this half-awake, pardon me if it doesn't make sense. :)

Give the box a variable, say, SequenceNumber. The first box you are supposed to touch would have a value of one, the second, two, etc.
The player could have a variable called CurrentSequence, set to 1.
Give the player another variable, CorrectGuesses, set to 0.
Give the door a variable called LevelGuessTotal and set it to n (n being the number of boxes you have to hit, 7 in your example).

Player hits correct box
Player collides with box (or presses button while overlapping box)
+
Box.SequenceNumber = Player.CurrentSequence
-> Player.CorrectGuesses + 1
-> Player.CurrentSequence + 1

Player hits incorrect box
Player collides with box (or presses button while overlapping box)
+
Box.SequenceNumber != Player.CurrentSequence
-> Player.CorrectGuesses - 1
-> Player.CurrentSequence + 1

Activate Door
Player collides with box or presses button while overlapping box)
+
Player.CorrectGuesses = Door.LevelGuessTotal
-> Open Door

else
Door doesn't open
B
9
S
1
Posts: 22
Reputation: 509

Post » Tue Feb 10, 2015 5:56 am

I knocked together a (really, really hacky. Seriously, you should probably clean this up!) example of this. Basically, I generate a value for each door, choose 2 and add them together to get the solution, and then listen for input over the door. If you press X over a door, it adds it to a value on the character, which I've displayed over its head. Then, if the character's value matches the value of the door and you press X, then a win message is displayed. It should be enough to get you going in the right direction. You might want to add a variable for operators, for example.
You do not have the required permissions to view the files attached to this post.
B
6
Posts: 16
Reputation: 284

Post » Thu Feb 19, 2015 9:05 pm

saumanahaii wrote:I knocked together a (really, really hacky. Seriously, you should probably clean this up!) example of this. Basically, I generate a value for each door, choose 2 and add them together to get the solution, and then listen for input over the door. If you press X over a door, it adds it to a value on the character, which I've displayed over its head. Then, if the character's value matches the value of the door and you press X, then a win message is displayed. It should be enough to get you going in the right direction. You might want to add a variable for operators, for example.


Wow this was actually was my first idea in the begging, but it seem though. This will help, but I was looking into the events and it was very hacky. Is there way to put some general comments in there to help sort it out? Also It suppose to destroy the box after it click it, but seems like an easy fix. This helps me a ton. Thanks! :D
B
10
S
2
Posts: 25
Reputation: 670

Post » Thu Feb 19, 2015 9:07 pm

abj84 wrote:This is a rough thought, but I wanted to give you some ideas. I'm typing this half-awake, pardon me if it doesn't make sense. :)

Give the box a variable, say, SequenceNumber. The first box you are supposed to touch would have a value of one, the second, two, etc.
The player could have a variable called CurrentSequence, set to 1.
Give the player another variable, CorrectGuesses, set to 0.
Give the door a variable called LevelGuessTotal and set it to n (n being the number of boxes you have to hit, 7 in your example).

Player hits correct box
Player collides with box (or presses button while overlapping box)
+
Box.SequenceNumber = Player.CurrentSequence
-> Player.CorrectGuesses + 1
-> Player.CurrentSequence + 1

Player hits incorrect box
Player collides with box (or presses button while overlapping box)
+
Box.SequenceNumber != Player.CurrentSequence
-> Player.CorrectGuesses - 1
-> Player.CurrentSequence + 1

Activate Door
Player collides with box or presses button while overlapping box)
+
Player.CorrectGuesses = Door.LevelGuessTotal
-> Open Door

else
Door doesn't open


This looks like it can work. Looks good thanks, but I'm now changing it up a little.
B
10
S
2
Posts: 25
Reputation: 670


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest