Duplicating objects....

For questions about using Classic.

Post » Fri May 23, 2008 12:09 am

[quote="Jeswen":1hojthor]Have you considered having the player click a chest for this mini-game? They can still have to be near it, but that would save you a lot of hassle I would think.[/quote:1hojthor]

Well... actually, the chests aren't the real problem. They won't be right next to each other so I can just allow the player to control the main character as they normally would to open the chests.

I used them as an example because solving the problem with duplicating them and having them right next to each other without triggering both would also enable me to have patches of ground that can be dug up.

I was trying to kill two birds with one stone... or one .cap, if you will.


Ugh, what a terrible analogy. :roll:
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Fri May 23, 2008 12:30 am

Right, well then change the word chest with dirt. Hehe.

Can you have the player click near them to dig?
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Fri May 23, 2008 12:56 am

Well... I'd like to keep the controls to just the keyboard, but moving the character with the keys and interacting with objects using the mouse wouldn't be too bad. Or I suppose I could mimic the controls for Ultima 7 and have it so that holding the right mouse button down moves your character and clicking the left performs actions.

Man, I love that game...
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Fri May 23, 2008 1:05 am

Another odd idea that occurred to me is, maybe you could have the player hold down a key (representing the shovel or equipped item) and then the arrows (or whatever you end up using to move) can dictate where the hole is dug around the player.

I'm tired and you're welcome to ignore that idea if needed lol.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Fri May 23, 2008 1:24 am

No, no. I welcome any and all ideas... odd or even.

I think if I can't get my original plan of keyboard only with a single action key then I'll either go with a hybrid mouse/keyboard control scheme like you suggested or a mouse only.
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Fri May 23, 2008 10:33 am

I dont know Who did it , but i saw a very elegant solution for ur problem in the .cap of a spaceshooter.

So excuses to the "Who" person for not mentioning him/her as source.

But this person filled every cell of the field with an invisible square object. On the moment he builded something on the cell, he erased that object. Moment the cell became empty he spawned an instance of the object on that place to mark it as Empty.

Dooing so gives u a Great advance by using "pick random".

Lets Call the object TheEmpty.

Then "pick a random TheEmpty" will only pick places where nothing is build yet. Because TheEmpty is only present on empty places.

To do this for 3 chests, you make a loop from 1 to 3. Something like this.



(event) For loop "Here_to_stay" 1 to 3
(event) Pick a random "TheEmpty"
_______________________________(action) create "chest" on "TheEmpty"'s position
_______________________________(action) destroy "TheEmpty"




When i saw that solution, i was very very pleased with the straightforwardiness (guess thats no word), and with the simplicity

Do you need a .cap ? i can when i am home, at work at the moment
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Fri May 23, 2008 12:57 pm

Try and find that example TheInstance.

That many objects seems a waste though. Maybe what is really needed is a grid object of some sort.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Fri May 23, 2008 1:47 pm

B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Fri May 23, 2008 4:30 pm

a quicly made .cap to illustrate

http://www.mediafire.com/?lk3nod2jmym
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Fri May 23, 2008 8:51 pm

Well... what I was planning on doing was just having multiple layouts and switching to the next if you decide to go up to a larger number of chests. You would start off with three chests in a triangle, the next four chests in a square, five in a pentagon, etc.

Have a variable for each chest to identify them and generate a new variable named 'contents'. If its the first level generate a random number between 1 and 3 and if it generates a 1 it makes the first chest the one with the gold, a 2 the second, etc.

Or... would having lots of layouts be bad for performance?
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests