A few hard questions

For questions about using Classic.

Post » Tue Apr 22, 2008 12:24 am

Yeah... detectors seem superfluous. One could either use one detector object that moved around, or calculations based on distance, maybe. But, I don't know what you're really doing or anything about math. So I'm sorry, this post is pointless. :D
B
4
S
2
G
6
Posts: 161
Reputation: 2,597

Post » Tue Apr 22, 2008 5:45 am

I'm sorry if i'm sounding rude now, but could people try to answer my questions? This is why i didn't write the whole thing from the beginning. I just want answers to my first two questions. Please focus on that.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Tue Apr 22, 2008 6:12 am

I wish I could help you, but by this point I am entirely confused. I understand if you want your project kept in the dark, but by doing so - I mean, not even giving us a hypothetical use for this - then all I see is a web of box objects set in a container and positioned/valued on creation. In a sense, I'm doing something similar in my own project. Deadeye was able to give me a boost here: viewtopic.php?f=3&t=825

Look for the cap file. I think it might help at least the part of your problem where you want to assign container objects an ID upon creation.
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Tue Apr 22, 2008 9:44 am

Well, i've tried to answer your questions. It's going to be used in the AI, and as a hypothetical use.. Well... look at the image and imagine a tiny enemie with the ability to transform into a big monster once every minute. Then when one minute has passed, and the detectors 39,40,41 are overlapping, and 13,14,15,22,23,24,30,31,32,33 are not overlapping, the creature transforms. If the detectors above and around him are overlapping, that means ther's not enough space, and he can't transform. This was a bad example, i just tried to come up with something that was matching the picture, but hopefully you get the idea. I will need to easily create many triggers on many different combinations of overlaps, and i need to be able to create a new "thing" and create and position the objects. It's not hard to do. it just takes a lot of time, and i thought there might be a shortcut.

Edit: [quote="Vrav":3315qv7l]One could use one detector object that moved around[/quote:3315qv7l]

I've thought of that too.. I'll try to come up with a simple way to do that. would it require less or more memory?
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Tue Apr 22, 2008 10:03 am

O, i c wut u did thar.

Actually, Why don't you just take the mathwork out of it and create "no transform" zones built into your levels?

If you're worried about overlapping a wall on one side (or two adjacent, in a corner) you can run a simple distance check in your cardinal directions. Alternatively, write a push algorithm so that your monster can transform in "safe to transform" areas without worrying how close to the wall he is.

I just think the whole "let's write thirty-thousand detectors" thing is an awful lot of work to accomplish what can otherwise be planned for and convincingly faked.
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Tue Apr 22, 2008 12:55 pm

[quote="Attan":3vgo6y4b]This was a bad example, i just tried to come up with something that was matching the picture, but hopefully you get the idea. I will need to easily create many triggers on many different combinations of overlaps[/quote:3vgo6y4b]
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Tue Apr 22, 2008 5:48 pm

Okay Secret Sally, I think people have squeezed enough information out of you to actually be able to help now.

Use one detector and a series of two loops to load your array.

Let's set a couple of ground rules first:

We're using your grid picture in the first post as reference (nine by five grid)
Box 1 is located at 0,0
Every box is 32x32px
Your collider object is 32x32px
Your collider object has a cell counter to keep track of which grid space it is over
The places where your Collider detects an impassable area are all in the family "Hard"
You will be using two loops in a nest, the "outer" loop runs five times (for grid rows) and your "inner" loop runs nine times (for grid columns)
This example uses a string to store the info, like you asked, but you could modify it to use an array
There are two text objects, "collisionText" and "freespaceText" to store the strings

Obviously, your real setup might be different but this is just an example

Okay, let's start:

1. Before the loop, reset all of your strings to empty (not "0", just nothing at all. No space between quotes.)
2. Set your collider object to 0,0
3. Set your collider object's counter to 1
4. Start your loops:

[code:1it2l6qf]
+ On loop "loopRow"
+Repeat 9 times
+Detector overlaps "Hard"
+Detector.Value('counter') = 1
- collisionText: Set text to Detector.Value('counter')
+Detector overlaps "Hard"
+Detector.Value('counter') > 1
- collisionText: Set text to collisionText.text & ", " & Detector.Value('counter')
+Detector does not overlap "Hard"
+Detector.Value('counter') = 1
- freespaceText: Set text to Detector.Value('counter')
+Detector oes not overlap "Hard"
+Detector.Value('counter') > 1
- freespaceText: Set text to freespaceText.text & ", " & Detector.Value('counter')
+ Always
- Add 1 to Detector.Value('counter')
- Detector: Set X to Detector.X + 32
+ On loop "loopRow"
- Detctor: Set Y to Detector.Y + 32
- Detector: Set X to 0
[/code:1it2l6qf]

That's a total of eight events for the loops, and that includes the redundant events to make sure that the counter is at 1 so it doesn't put a comma at the beginning. Of course I'm just doing this off the top of my head so it might need some tweaking but the basic idea is there.

Edit:
Also, in the future I suggest you give as much information as possible when asking for help, and don't hold back if someone asks for more info. It just makes it more difficult to help.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Apr 22, 2008 6:30 pm

[quote="Vrav":24abfael]Yeah... detectors seem superfluous. One could either use one detector object that moved around, or calculations based on distance, maybe. But, I don't know what you're really doing or anything about math. So I'm sorry, this post is pointless. :D[/quote:24abfael]

That wasn't pointless! The moving detector worked like a dream!

@ Deadeye.
WOW! Just this minute i finnished it, and it was allmost exactly what you wrote (eccept i made it possible to ajust the grid with and number of cells). The only thing i hadn't figured out yet was how build the text in a string correctly (the &-sign).

Awsome! Thanks for your efforts guys! The only thing i need now is how to search a string for a specific phrase!
Edit: Which i allready have, since i've asked for it before: viewtopic.php?f=3&t=705&p=4188&hilit=search#p4188

Next time i'll try to post more info, but sometimes i'm not looking for a new solution, but just for the answer to my question. I'm still curious about if it's possible to create many objects at the same time in a specific pattern.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 10 guests