Hi everyone. I posted this at the Clickteam forums, but no one there was able to help me.
I am developing this mini-game for a much larger game (www.upforums.com/shadybrook), but I have been trying to code this for over a week, and with no success.
The concept sounds quite simple. On the screen is a grid full of different shaped pipes. There are a total of 4 different pipe Active Objects, and multiple instances of each. The player can click on a pipe to rotate it 45 degrees.
A special pipe on the left is blue. When a pipe that you rotate overlaps with this special pipe, the pipe you rotated then turns blue (by changing to a User Animation).
What I want to happen is, simply, whenever a pipe "connects" to a blue pipe, that pipe turns blue. Otherwise, the pipe stays normal (using the Stopped animation).
I have tried everything from qualifiers to loops, but I cannot get this to work properly. The problem comes in when I have to have a pipe return to the stopped animation when it is no longer overlapping a pipe that has the user animation running.
I don't think you can attach files here, so I uploaded my application as it is now.
Thank you very much for your fast reply! I am unsure how to do what you are describing. I define the direction for each object after the user clicks on the object. How can I use this as a condition to check whether two objects are connected (and if so, start the animation). I am already using an image for all directions used, so I can't add any with extra images. (Sorry if I sound confused, but I'm new at using Fusion.) Thanks again!
"The problem comes in when I have to have a pipe return to the stopped animation when it is no longer overlapping a pipe that has the user animation running. "
It is on loop already. I'm simply not sure how to tell Fusion the following statement:
If Pipe A is no longer overlapping any pipe (A, B, C, or D) that has the animation "Power" playing, then set Pipe A to Stopped.
When I put it in as the following statement, it does not work properly:
+ Pipe A overlapping Pipe B
X + Pipe B "Power" Animation is Playing
:: Set Pipe A to "Stopped"
I think it's randomly checking ANY Pipe B, not necessarily the one overlapping with Pipe A.
The other problem is that incorrect pipes are running the Power animation, due to the same issue. Fusion is randomly choosing pipes, not necessarily the ones that are overlapping.
I need to somehow create a loop that checks one pipe at a time, comparing it to every other pipe in the frame. Would that be possible? I see it as having to create two loops that act as one. One loop would be needed to check every pipe for the condition, and a second loop would be needed to compare it to every other pipe in the frame. I'm just not sure how to accomplish that.
I think that using Spread a Value and Fastloop should solve your problems here. Once again I have to admit that I'm not sure exactly how it should be done, but I think it goes something like this:
+Start of level
Spread value 1 in Value A of Pipe A
Spread value 1 in Value A of Pipe B
.
.
.
(This assigns unique values in Value A of each pipe)
+ Always
Fastloop: Start loop "Loop" for (Number of Pipe A object) cycles
+ On loop "Loop"
+ Compare two general values: Alterable Value A("Pipe A") == Alterable Value A("Pipe B")
+ Pipe A is overlapping Pipe B
Set Pipe A animation to Stopped
That's the exact programming I'm using (smart minds think alike hehe), and they change to the user animation perfectly. The problem is getting them to return to the stopped animation when they no longer connect. I have all pipes automatically set themselves back to stopped every time the player clicks on one particular pipe (thus changing the pipe directions), so theoretically it should work. But for some reason it still isn't. I was hoping someone could look at the code I have and see if I'm doing something wrong. Thanks for your reply!!!
n/a
Peblo Custom ratings must be 50 characters or less
Registered 05/07/2002
Points 185
26th May, 2005 at 18:50:23 -
You could try shifting the events around, like in and out of groups, shifting event order around. Whenever MMF ignores my code, thats what I do. It works most of the time, for some reason.
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath
Hmmm, If that doesn't work I hope I make more sence this time.
Rather then using animation frames to set the direction of the pipe. Use different animation in different direction within the same animation group( in your case- Stopped).
This means that to change the animation, all you need to do is change the direction of the object.(It also means you get 32 animation frames)
The advantage of this is that you can set the individual pipes direction using an expression with it's own value of A.
(It might help to rid yourself of those horrible fastloops depending on what your doing.)
Seeing as you have the pipes with 8 directions, I suggested
using the 8 default directions within the animation to make it easier to work with. The 8 directions are: right, up-right, up, left-up, left, down-left and so on.
The direction can be changed by simply setting the value of the direcion to a number(which can be done by clicking on the '1+1' when doing a 'set direction' event.
Those 8 directions of the numbers above are 0,4,8,12,16 and 20 in that order.
Thus, by setting the value to 8, you'll set the direction of the object to up.
Hense the "set (the pipe's) direction to value A(of the pipe) x 4. -which is 8 directions.(Sorry, I didn't mean "4A-8" )
Thank you again! I am going to try this as soon as I finish typing here.
In the meantime, this just occurred to me:
The pipes are situated in a grid-like structure. Could I use an array, easy grid, or some other method to do the following? Because this might be easier:
Give each grid a value (0 or 1). For each grid, check if a surrounding grid's value = 1. If so, set that grid to 1. Otherwise, set to 0.
I don't know if this would be easier or not, but it might be another way of going about this.
Just wanted to update for everyone: I got it to work! I made each pipe object part of the good qualifier AND bad qualifier. I then added a conditional statement at the end saying:
+Always
+If qualifier.good overlapping qualifier.bad
+Qualifier.bad is Stopped
:Set qualifier.good to Stopped.
It works quite well now. Thanks again everyone for your help and suggestions!!!