Duplicating objects....

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Oh and, you can size the Thekey object to 1 pixel width, and separate the chests by 2 pixels. This will solve your problem totaly. TheKey is now 2 pixels, i think.

    Yeah, that's what I thought too, but if he needs them touching for some reason, ordering them is really the only way I can see to avoid that.

    Otherwise, rethink the entire concept and not use a detector

  • I was pretty sure that it was TheInstance that you were annoyed with and not the thread, Jeswen (I've been spelling it with an "i" for a while ). I know he has shown a certain lack of, well... social skills in other threads but I really do appreciate the help that he gave.

    He was under no obligation to help out and he not only did, but he even addressed a problem that I didn't mention. So really, I don't mind at all.

    Anyway...

    What you suggested about the chests will probably work, but my original question had a dual-purpose to it. I'm making a mini-game where you pay a certain amount of money and three chests appear. You choose one of the three and you either break even, make money, or lose money. If you want to go on the number of chests increases each new round until you either run out of money or decide you've had enough.

    The mini-game will be a part of the larger game that I'm currently planning out, and I'm actually not going to have the chests sit directly next to each other. There will be enough space for you to walk in between them.

    However...

    One important thing about the main game is that I want you to be able to dig up any empty square of ground that is not part of a road or anything else that should not be altered, and for this to work properly I need to have the grass/dirt made up of lots of individual squares, and they have to be right next to each other with no gap in between (it wouldn't make any sense for the shovel not to work just because you're standing in the gap between two patches of grass).

    Well, I'm not sure if I'm going to work on solving the gap problem first or do some other things that I know for sure I can get done without problems. Hmmm... probably the latter. I'd like to have something worthwhile to post in the "Your Creations" section next week.

    And again, thank you both.

  • Otherwise, rethink the entire concept and not use a detector

    Thats always a possibility... I'd hate to spend a lot of time on the problem only to discover that it can't be done this way.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    Simple rectangle for a detector - if it's over a chest, they may click it. If it is over more than 1 chest, they may click either one, giving the player the choice.

    Or if you want to keep it entirely to keyboard, you could also use keys (such as 1 and 2) for when two chests are available.

    I may be going off track here, but I thought I'd check.

  • 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.

    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.

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

    Can you have the player click near them to dig?

  • 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...

  • 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.

  • 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.

  • 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

  • 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.

  • your command sir

    http://www.mediafire.com/?brwzz4zjzgw

  • a quicly made .cap to illustrate

    http://www.mediafire.com/?lk3nod2jmym

  • 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?

  • Should be fine with multiple layouts.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)