Prev Next buttons with more than two objects?

Get help using Construct 2

Post » Wed Apr 03, 2013 11:12 pm

This is kinda hard to explain so I have included the capx below....

https://www.dropbox.com/s/9nbrpfjdu96jwn3/jump.capx


I'm trying to make a menu with three options (Map1, Map2, Map3) but I'm having some problems. Each "MapX" is a sprite image that you click to go to that map. I'm using a Previous Next button system to cycle through the map choices.

With two objects (Map1, Map2) it's easy, but if I add a third (Map3) it jumps straight to the last option and bypasses Map2. I put a timer in as a test and it does indeed load Map2 then Map3, but a single click on the next button is starting both events.

Am I doing this completely wrong? How can I get this to cycle through one step at a time? I've tried everything I can possibly think of and I'm out of ideas.   

Thank you in advance for the help!
B
3
Posts: 5
Reputation: 335

Post » Wed Apr 03, 2013 11:52 pm

To clarify a bit, I have two Next buttons, Next #1 and Next #2. I'm not trying to run two events off of a singe object.

1. When you click the Next button #1 it moves itself and Map1 out of the layout and puts Map2 and Next button #2 in their place.

2. When you click the Next button #2 it loads the Map3 image, etc etc etc.

Again, everything works fine with just two options, but if I add in a third it's like the single click is triggering both events.

Here's some screens:

The Layout
http://www.dropbox.com/s/hm1t9b5inw16lj3/menuscreen1.jpg

The Event Sheet
http://www.dropbox.com/s/k1l2pmtc09a2afn/menuscreen2.jpgChronos2013-04-03 23:52:44
B
3
Posts: 5
Reputation: 335

Post » Thu Apr 04, 2013 12:05 am

The events are checked in order. When you click on mapSelect_nextMap2 then event 3 moves mapSelect_nextMap3 under the mouse, then event 4 runs and thinks you've clicked on that too. The easy way to fix it is to swap the order of events 3 and 4.

A better way would be to have one sprite for mapSelect_map and one for mapSelect_nextMap and use instance variables to track the current and next maps.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Thu Apr 04, 2013 12:30 am

[QUOTE=ramones]
A better way would be to have one sprite for mapSelect_map and one for mapSelect_nextMap and use instance variables to track the current and next maps.[/QUOTE]

You mean make an instance variable on each map sprite defaulted to 0 and when that map is selected set the variable to 1, and then add an exception to only run if the map variable is 1?
B
3
Posts: 5
Reputation: 335

Post » Thu Apr 04, 2013 12:49 am

I mean one map sprite where each map is a different frame. When you click on the next button it adds 1 to the frame and when you click previous it subtracts 1. You don't even need a variable, just use the frame number. When you click on the map sprite, go to a level based on it's current frame.

mapSelect.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 18 guests