Von Perkele's Forum Posts

  • You do not have permission to view this post

  • Can you upload a sample project.

  • Yes it seems obvious now. Thanks.

    Another solution I thought was setting the array data to the variable when season = 2, before loading the data.

    However, it is not possible to make the array data itself act like an equation or function?

  • Hi,

    I'm using an array to store numbers. An object will get a number from the array slot that is based on current biome and season of the level. There's also a random number that gets generated at the beginning of every day in the game. There are some seasons that I would like the object to use that randomly generated value instead of a static number. Is it possible to store a "command" in the array slot that will make the object to use that randomly generated variable instead? Sorry if this is confusing.

    This is an example project that tries to illustrate what I want to do:

    dropbox.com/s/4szc39sdcfyvfec/ArrayDataTest.c3p

  • Black hornet pretty muc said it already. Here's the example file anyway:

    dropbox.com/s/il28yi6430o7ws4/NewFlappyBirdIdea.c3p

  • Now the reason you BG is not set to a new position is because you are using the condition X = - 960. That means the condition is only true when X is exactly = -960, which it probably never will be since the X coordinate is changed in "chunks" with the dt function, it does not go through every possible x value.

    So to make your condition work change it to X <= (less or equal) -960.

  • Hey,

    First thing that is wrong here is that you are using an image that is size 5000 x 500. That is NEVER how you want design your games.

    You really want to read this:

    construct.net/en/make-games/manuals/construct-3/tips-and-guides/memory-usage

  • I suppose you would have to design the game to have at least two modes for this. You could call them "exploration mode" and "battle mode". Maybe a third "cut scene" mode as well.

    In "exploration mode" the player moves the character(s) in the play field. When the player approaches an enemy the "battle mode" is activated. Manual player controls are then disabled.

    I suppose you need to create a system that randomly sets the positions of enemies and players when "battle mode" is activated. You can create code that finds positions for all the enemy and player characters while checking that these positions are not too close to each other or within or too close to impassable terrain. Then you can use the "go to" behavior to move the sprites to their correct position.

    Then you need to create a turn based battle system. This in theory should not be too hard either. You have to create a "speed" stat for player and enemy characters, and based on that a timer then calculates the action turn order.

    The next part is probably the hard one. You need to create a bit more complex systems for all the "battle mode" menus, different attacks/magics/special abilities/item use etc. Specific actions are performed based on what the player chooses from the menus, after the battle timer has calculated that it is their turn.

    As for the enemies, you probably want to use the advanced random plugin to make them use randomly different attacks. That would probably do for simple basic enemies, but you could also code more advanced attack patterns to different enemies to improve and diversify their behavior.

    I don't have a template, but I don't see how you couldn't do it. It's just a lot of individual small parts that need to be put together one by one.

  • Hey,

    If you want those conditions to only trigger once when true, then you can fix them by adding "trigger once" condition in them.

  • You get the Vy from this equation:

    y = h + Vy * t - g * t² / 2

    If you know "t" (time of flight), then y = 0 when the projectile has flown "t" time. Or in other words, the projectile hits ground (y = 0) after time (t) has passed. So you can insert y as 0 and your chosen t to the function.

    From this formula you eventually get:

    Vy = gt/2 - h/t.

    If your projectiles are thrown "up" or towards the top of the layout you need to take the opposite of this function since in Construct that is negative speed (y is decreasing while traveling to that direction), so we use:

    Vy = -(gt/2 - h/t).

    I actually improved my example. In this version you can also choose to manipulate Vx since I realized that might usually be more useful that using t as a constant. Remember you could also calculate the time of flight or Vx based on the distance between the player and enemy or any other factor you want, which will give you more tools to tweak the trajectory just the way you want it.

    Improved example:

    dropbox.com/s/lrnqt7iy21t82t6/Trajectory_Improved.c3p

  • Hi!

    The important thing while calculating trajectory is that you need to figure out which parts of the equation you want to set as constants. This is my example using the "time of flight" and "gravity" as constants. You might want to play around the the trajectory equation if you want to for example change the angle of trajectory or Vx component to be the primary constant.

    dropbox.com/s/vg0shir90yxwtcz/Trajectory.c3p

    Useful link for the equations:

    omnicalculator.com/physics/trajectory-projectile-motion

  • WackyToaster,

    What do you mean by changing the image points and 9 patch? I've never heard of 9 patch before.

    I'm still playing around with it and I really want to know how to do it with image points as well as move to. (I need to learn everything)

    I messed around with the image point some more, but the thing still goes up in there air.

    I changed a bit of it and reuploaded it if you'd like to see what I've done since (messed up since)

    https://drive.google.com/file/d/15K2aOkcPutqi1mmGooQc5Kgx0BdVIAhg/view?usp=sharing

    Thanks.

    The player sprite goes up because you haven't set the image point to the same point in the middle of the player "body" in all animation frames.

    You really should not use that method though. It's clunky and uses a lot of unneeded animation.

    I didn't notice blackhornet's example. That tiled background method seems better than my method, thou.

  • Ok, good to know.

    It would have been handy to be able to dynamically choose an equation from an array, but I can work around this limitation.

  • Hi,

    I think I made it work the way you want.

    dropbox.com/s/28xyd2vbsic9ex8/monsters.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads