oosyrag's Recent Forum Activity

  • I think you're in the very advanced problem zone =P

    How are your roads placed? Are there constraints like do they need to be connected at ends only, is there a limit to how many roads per intersection?

    When you create an intersection, you'll need some information there including which direction each option is in, and how long that road segment is.

    Basically every time you place a road, you will need to add information at the intersection it was placed on.

    You'll also need to create your own pathfinding - A "simple" pathfinding algorithm would find every possible path to the destination, and compare the total values (length?) of each segment of road to pick the path with the lowest total number. This algorithm should record which road to take at each intersection in a variable or array, which the car then references to make its drive.

    Given that your roads are straight, you can have the car angled at the same angle as the chosen road and have it move forward until it hits another intersection.

  • There are several inventory posts in the FAQ stickied in this forum, as well as a lot of people asking for more specific advice if you search for it..

    how-do-i-frequently-asked-questions_t63692

    search.php?keywords=inventory&fid%5B0%5D=147

    There are also quite a few inventory tutorials in the tutorial section.

    https://www.scirra.com/tutorials/search?q=inventory

    Most inventory systems are based on an array. There are many ways to display what is in the array or to change the size of the array.

  • This can be a simple fix or a very very advanced problem depending on what exactly you need. You'll need to be more specific, or post a capx. Are your roads straight? How is your car being controlled? Are there multiple paths to the destination?

    This is a quick trick - make an invisible sprite at each intersection. You can use these invisible sprites to check for collision with the car and do an action when the car reaches the intersection.

  • Sorry I didn't answer your question of how to get it to work, I only told you why it doesn't work =P

    Not sure if this is the solution, but try changing the variable before the wait, and use sub events

    Check line of sight - Change to Shooting
    Is Hiding           - Wait 2
    
           Check line of sight - Fire
           Trigger once        - Wait 2
                               - Change to Hiding[/code:3qcekd1b]
    
    (EDIT: Formatting)
  • Wait doesn't prevent your second event from going off every tick.

    So in that 2 seconds you are waiting, that second event will keep running, and keep queuing up the action to set state to shooting. After 2 seconds is up, for the next two seconds it will keep setting SpecificState to "Shooting"

    Your third event only runs once, right when the first 2 seconds is up. It shoots and sets the state to hiding. But the previous action was queued up for 2 seconds more and keeps setting the state back to Shooting. Since your third event has trigger once, you never get to set SpecificState back to hiding.

  • An array is already global, so the data in them does not get reset when changing layouts. For non global objects, you can use https://www.scirra.com/manual/161/persist

    JSON is useful when writing array data as a single string to use to save to a variable, file, or local storage.

  • No need to put yourself down! Everyone has to start somewhere.

    So a normal animation usually runs one animation frame per system frame. So the speed is dependent on your system frame, or fps.

    By using Sprite.AnimationVariable+60*dt, your animation will progress at 60 frames per second regardless of what your system fps is. If your fps is lower than 60, some frames will be skipped. Or you can use 10*dt for 10 frames a second.

    The problem is that you can only set a whole number as an animation frame, like frame 1, 2, or 3. You cannot have a frame 3.248. The dt expression will start giving you fractional numbers. So to get past this we use either floor(), which means round down, and ceil() (ceiling), which rounds up. Floor(3.5) = 3, ceil(3.5) = 4.

    This gives us a new problem though - if I just use the animation frame and add to it, it might keep rounding down, preventing the animation from progressing! For example, I'm on frame 2, and dt adds .9 on tick. This 2.9 gets rounded down to 2. Next tick, I add .7 - this 2.7 also gets rounded down to 2.

    This is why we need a separate variable to keep track of our progress. As in the previous example, If I stored the 2.9 in a variable, this tick would show animation frame 2, then next tick I add .7 to 2.9 resulting in 3.6, this would show frame 3.

    Looping -

    Sprite.AnimationFrameCount gives you how many frames an animation is, lets say 13. Normally, it would progress from 0, 1, 2, and so on until 13. Then instead of 14, which doesn't exist, it would go back to 0. Now we have the same problem as above when using dt - we get decimals instead of whole numbers. If we progress from 13.7 to 14.5, we want to carry over that .5 when we go back to the beginning. You can do this with modulo. 14.5%14=0.5

    So basically the loop event I described as above goes like this:

    If my current AnimationVariable (14.5) is greater than AnimationFrameCount+1 (14. I didn't have +1 above but should have since we're rounding down), set AnimationVariable to 0 + whatever is leftover after 14 (14.5%14=0.5). Then of course we would need to round down to set the actual animation frame which is 0. But the next tick would continue adding from 0.5.

    This is a bit past beginner territory, so don't be discouraged if you don't get it. Good luck with your project!

  • On Bullet Hit

    Create particle at Bullet.X, Bullet.Y

    Set Particle angle to Bullet.Angle

    Move Forward Particle Offset Amount.

    Destroy Bullet

    Might have to play with a little trig math to get a really accurate offset amount, but you might not need that.

  • The built in animation is by frame, so each frame rendered will progress the animation by one frame.

    You want to set the animation speed to 0, and use events to progress the animation.

    Every tick - Set Sprite.AnimationVariable to Sprite.AnimationVariable+60*dt

    Every tick - Set Sprite.AnimationFrame to floor(Sprite.AnimationVariable)

    This assumes you want it to run at 60 animation frames per second. You need a variable and Floor is to round down to the nearest whole number. You can use ceil() to round up instead.

    To Loop

    If Sprite.AnimationVariable > Sprite.AnimationFrameCount - Set Sprite.AnimationVariable to floor(0+Sprite.AnimationVariable%Sprite.AnimationFrameCount)

    Use modulo (%) - this will give you the remainder of a division. In this case, its how much you overshot total frames by.

    Depending on how fast you want the animation to play, you might have skipped animation frames if the target device is running at a very low fps. Could be desired though!.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One simple method would be to have your object made up of several pinned sprites, and each one can be destroyed/damaged on its own.

  • I'm gonna say a build-your-own flexible combo system would be pretty awesome - like the original Xenogears or Majika.

    One of the most memorable mechanics for me in Secret of Mana was when you maxed out your magic, it would get a whole new set of animations. Also how each weapon was pretty unique and had their own sets of special moves.

  • Great!

    Just an additional quick tip - you can add additional image points to a sprite besides just the origin point, and get those point positions via expressions for all sorts of uses. You can have different points/locations on different animation frames too.

oosyrag's avatar

oosyrag

Member since 20 Feb, 2013

Twitter
oosyrag has 38 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

21/44
How to earn trophies