Handle Data Sets and Prototypes?

0 favourites
  • 8 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I'm currently trying to learn Construct 2 by making a Tapper clone. I'm currently at the place where I have a bar tender who makes a filling/throwing motion, which spawns a mug object that travels down the bar until it topples when reaching a certain X position.

    Now, I need the bar tender to move up and down the bar, "snapping" to the correct X and Y coordinates when he makes a move. Likewise, the mug object needs to know which bar counter it is on and look in some kind of data set to find out what the maximum X position is before spilling. Any suggestions on how I can do this most efficiently (and any documentation to give me a good start)?

    Also, on a somewhat unrelated note, how can I have an object "prototype" that has all the properties and code set, but doesn't need to be pre-set in the world? The mug object I previously mentioned makes a falling sound as soon as the game begins because it is flying around off-screen and "falling" after it goes past the minimum X location. Obviously, I don't want the prototype to do that. How can I prevent it?

  • destroy mug object at begining of layout to solve the sound problem, i think you have to have objects in the layout, but hopfully that will be sorted in a future build

    There are lot of various easy way to do these but need more info on how your bar(s) are set up and how the bartender moves?

  • Re: prototype. You can also make an extra Layout and place your dynamic objects on it, instead of the playable Layout.

    Re: positioning. LIONHART is right. We'd need a bit more info to help. Posting a CAPX of what you have so far may help. You can use LiteTween to move to a specific location. You can use arrays, or just math if the intervals are a fixed distance. All depends.

  • I went ahead and set the layout to destroy the prototype when the game begins. Thanks for that suggestion!

    As for the positioning, I really have no specific plan because I don't know what options are at my disposal. Each bar will be a series of sprites on multiple layers (a background sprite, a foreground sprite, and a "cover" sprite in the cases where I need to make it seem like the patron sprites are coming out of a door), each with a different layout. There will be changes in where the player should be positioned in the X and Y at the end of each bar and each bar should have a specified "beginning" and "end" X and a certain Y coordinate. This will be used to spawn the patrons (which will move along the bar from its X start toward its X end), handle spilling drinks (which will spill if they reach the X start without touching a thirsty patron), and handling refills (which will drop off the bar if they reach the X end without the player in the appropriate bar index to catch them).

    Basically, I'm trying to emulate the real Tapper game as closely as possible, so just imagine what would be needed to get the player to snap to the right movement positions and to indicate where the mugs and patrons should see as the ends of the bar. There will additionally be multiple levels, as in the original Tapper game.

    youtube.com/watch

  • If I had the option of programming this in C or something like it, it would be fairly simple:

    int barkeepX[4] = { 240, 246, 252, 258 };

    int barkeepY[4] = { 30, 80, 160, 220 };

    int barTop[4] = { 34, 84, 164, 224 };

    int barStart[4] = { 30, 36, 42, 48 };

    int barEnd[4] = { 236, 242, 248, 254 };

    int barkeepIndex = 0;

    if (pressup == true && barkeepIndex > 0)

    {

         barkeepIndex--;

    }

    if (pressdown == true && barkeepIndex < 3)

    {

         barkeepIndex++;

    }

    if (pressdown == true || pressup == true)

    {

         barkeep.x = barkeepX[barkeepIndex];

         barkeep.y = barkeepY[barkeepIndex];

    }

    if (spacebar == true)

    {

         mugSpawn(barkeepIndex);

    }

    void mugSpawn(int index)

    {

         mug.y = barTop[index];

         mug.x = barStart[index];

         while (mug.x < barEnd[index])

         {

            mug.x++;

         }

    }

    ...etc. The logic seems simple and sound. I just don't know how to implement it with Construct 2. Boy, do I wish that it supported direct scripting for this sort of thing. I really, really, really hope that becomes a feature, or else I can't imagine sticking with Construct for very long once things get complicated.

    Still, I want to give it a chance and learn (and I've already paid for the Personal license!), so what method would the veterans recommend?

  • blackhornet

    LI0NHART

    Bump so that this question doesn't get lost. What method would you two (or anyone else who reads this) recommend for what I'm trying to do?

  • Since C2 has a visual editor I'd recommend putting a barkeep at each bar and making them all invisible except for one at a time. That way it's easier to tweak the barkeeps position rather than adjusting numbers manually. For the bar top/start/end you could again just use the editor to position the bars and use expressions. Another way would be to store the bar info in instance variables for each barkeep, if you prefer numbers.

    Oddly enough the C2 events will be practically the same as C.

    Here's a wip capx to pick apart:

    https://dl.dropboxusercontent.com/u/5426011/examples18/tapper_ex.capx

    It uses a container so each barkeep will be picked with it's respective bar. It also uses the bullet behavior to handle the mug motion, although you could do it straight with events if you wanted.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i would set up the bars at (lets say) 150 pixels apart on the y axis

    then upon pressing up or down the bartender would move that distance

    Exapmle:

    1st bar at 300 y position

    1st bar at 450 y position

    1st bar at 600 y position

    1st bar at 750 y position

    If bartender y position > 750 then set y position to 300

    If bartender y position < 300 then set y position to 750

    (this is how i did it for my zelda inventory navigation)

    and depending on what y position he is at set his x postion to the end of the bar.

    have invible boxes for all the posible places the customer could stand and have a pick object expression for them to move to it and then have it set to "occupied" or something so no other customer can use it.

    customers would also have a invisible box that when the drink overlaps it they would play their drinking animation, etc

    hope that helps

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