Go To Preferred item

  • Hello sorry, but my Construct 2 fu is weak. I played around with the basic tutorial which was very helpful, but I could use some help still. As what I'm trying to make is a puzzle game that has 2 phases.

    I'm trying to create a puzzle game. The idea is that the player set's up a course with a series of objects(Blue, Red Gems). Then once hitting start. The character will move through the course on their own. The character finds the nearest item on Hor/Ver(grid 10x10) and priority. Then moves to the nearest item.

    There is lot's of things I can't figure. Heres a few that really stumping me.

    Start the course on a button click. I've looked at system event for/each, but I can only do them as a new event and not something that stars with a button click.

    Choose priority object based on Hor/Ver, priority and distance.

    I can set attributes to the objects, but I'm not sure how to search through nearby items.

    Drag and Drop item spawner. The problem I seem to be having is that when I DnD I drag the spawner and leave the new Item where the spawner was :| I'm not sure how to create the item into the mouse select rather than move the spawner.

    I guess that's for starters.

  • To start on button click, use a variable (x) initially set it to 0, when the button is clicked set it to 1.

    Add an event System --> Compare variable --> x = 1

        Add the for loop as a sub event.

    For choosing an item Pick nearest/farthest Sprite event may help.

  • Thank you. It's given some avenues to work with :) I'll post again when I get stuck :D

  • Well seems like I just can't seem to figure this out. Let's see if I can relate the event sheet here

    Button-Onlick > Set isRunning to 1

    System-isRunning = 1

    -- Hound-Direction speed == 0

    ---- System-ForEach GemBlue

    ------ Hound-Pick nearest to(GemBlue.X, GemBlue.Y)

    -------- Actions

    -------- Hound.Rotate 0 degrees towards GemBlue.X, GemBlue.Y

    -------- Hound.set speed to 10

    Hound-is overlapping GemBlue

    Actions

    GemBlue Destroy

    Hound direction speed to 0

    The idea is that the Hound will move towards one object. Once there the object is destroyed and the hound looks up a new object and moves towards it. It doesnt work :| I'm doing something wrong and I just don't understand enough of C2.

    Some more assistance would be great. I did manage to handle the Spawner issue. I just create all the objects and have them overlap each other. I can put a counter to that later to let players know how many they have of what gem.

  • This may be an issue of SOL. Sharing the .capx would help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • studioryu.net/file/OmenHound.capx

    studioryu.net/file/%C2%A0%C2%A0%C2%A0if the above doesn't work.

    What's SOL. Though I suspect it's more an issue of newbness :D I have a few other bits in there trying to experiment.

  • Try this: http://dl.dropbox.com/u/28195143/c2_share/OmenHound_fix.capx

    I have modified the On Start event to destroy the first GemBlue you have outside the layout. This would stop the hound going after it.

    I have used the bullet behavior. You would not need a for loop here. The pick nearest event should be on the GemBlue.

    You don't have to worry about SOL (Selected Object List) here. It is a little advanced I think. You may look into these links if you want to learn more about it.

    http://www.scirra.com/forum/isolate-identical-sprites-by-variables-for-testing_topic50378_post317619.html?KW=#317619

    SDK Manual Entry: http://www.scirra.com/manual/29/object-type/page-1

  • Thank you. I'm going to look over this. Much appreciated :)

    I'll read over the links too

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