oosyrag's Forum Posts

  • Based on the difference between the timestamps, you'll know how much time was spent minimized. You can then use timescale to accelerate the game at a certain rate until the game has caught up. The faster the rate/higher the timescale, the greater the risk of bugs!

  • https://www.scirra.com/tutorials/202/to ... put-method

    https://www.scirra.com/manual/119/touch

    The Compare Orientation with Alpha Beta and Gamma in the touch object is what you are looking for.

  • On the every x seconds event, add this condition for each object: System - Pick Nth Instance. Object is your Tent Roof/Floor, and instance is Self.Count-1.

    It might actually just be Self.Count or just -1, Sorry I don't have C2 available at the moment to test, but basically you want it to pick only the last created instance to move for that event. If it doesn't work try the others.

  • Hi Bio,

    There are a lot of tutorials and different methods that address the problem you are describing. Here is one example that I like - https://www.scirra.com/tutorials/4981/s ... den-player

  • If you want new random every battle, why not just set RandomMonster to choose(...)?

    I guess you want to set a list of which monsters you can choose from before going into the battle. In that case I would create an array - Start with a width of 0, and then push to fill it with the possible choices, then in the battle layout set RandomMonster to Array.At(floor(random(Array.Width)).

    That's the first thing I could think of, there might be an easier way, maybe someone else could chime in.

  • When you put "choose(1,2,3,4,5,6,7)" inside quotation marks as you have, it is no longer an expression, but a string.

    I don't think you can have an expression inside a variable. Are you trying to have the random number picked when you go into the next layout? Or have the next layout pick the random number?

    You can:

    1. Use an action to set your GLOBAL_MONSG variable to choose(1,2,3,4,5,6,7), in which case a random number whole number between and including 1 and 7 will be stored in the variable. Then you can set RandomMonster to GLOBAL_MONSG and get the same number.

    2. Use a function that returns "choose(1,2,3,4,5,6,7)", and have your action set your RandomMonster variable to your function output.

  • I'm going to guess that the previous instance isn't disappearing, but after you make a new instance, both of them get set to the exact same spot.

    What is the purpose of the second event running every x seconds? This is what is causing all the instances of your tent objects to be set on the same spot.

  • Either -

    1. Store the destination in a variable and lerp to the variable.

    2. Create an invisible object at the destination and lerp to the object.

  • When objects are created, they are immediately picked by default, so any actions you have affecting this object only affects the newly created instance within the same event.

    A more advanced topic would be if you wanted to specify only the last created instance of an object in an expression - you can do this with the IID - Sprite(-1).Expression, where the -1 represents the last created instance of this object. https://www.scirra.com/manual/78/expressions

  • Why are you unable to compare the entered data with the variables?

    Are you using quotes for your strings?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A simple way would be to put the 'do something' part in a function, and have two separate events. Or just copy the actions again in both events.

    Cond1 is true | call DoSomething()

    Cond2 is true |

    Cond3 is true| call DoSomething()

  • I would create an object for each type of weapon that that has similar properties. For example, a single object might contain swords and daggers, and another might contain bows. Each frame in that object would be the variations of looks of that type of weapon, basically reskins. This would separate out your total weapons into several spritesheets, aiding in the loading issue.

    As for your reference/object id problem, you can use Constants if you like to refer to your object by name rather than number

    ie.

    Rapier=72

    ChickenSlicer=73

    You can use these in function, or anywhere -

    On Call EquipBlade(ChickenSlicer) - Create BladeObject, Set BladeObject animation frame to (param0). This would create the object and set it to frame 73. Constants are also easy to change in case your animation frame changes, besides which it is also pretty easy to reorder your frames in the editor.

    If all of your weapons have unique properties, it would make a lot of sense to use an array to store the data. When you get to a huge amount of unique weapons, it becomes much more manageable to keep track/edit in a spreadsheet program, and import it via project files as a CSV or XML to parse into an array on load.

    If you're worried about loading a whole bunch of weapons you don't need at once, again, you can use project files to load only the sprites you need on demand at runtime.

    Basically if you're objective is to create objects via expressions and strings, your best bet still is to utilize constants and animation frames.

    In the end, you mention best practices, but it is a pretty common advice here regarding optimization - unless you can notice a difference in practice, it is best not to worry about it and focus first on your game mechanics. I don't think it would be a big deal/difference to download 10 or 30 or 50 weapon sprites/frames in one object versus splitting them into 2 or 10 or 50 different objects. How many unique weapons do you have?

  • You can use families.

    To prevent from scrolling offscreen, you would use conditions to limit the event to only work within the range you specify.

  • I've never used it myself, so maybe someone else can answer better, but that's where I would start myself if I were looking.

  • The hackier/simpler way that I thought of first was just to check the distance between the center of the patty and the center of the bun. Unless there is a reason you need to get the specific area overlapped - and that can still be calculated from the distance if both shapes are fixed size circles.

    When you have irregular shapes or multiple instances of shapes, it gets more complicated though, and I don't have a quick answer for that.