oosyrag's Forum Posts

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!.

  • 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.

  • Is this the place for C3 requests? Just wanted to put in my two cents: built in vector graphics support would be great. I know there are some plugins already, but it was one of the most obvious things missing for someone who for example worked with flash before: SVG file support, canvas/drawing support, tweening.

  • Simple solution! Sorry I don't use behaviors much so wasn't familiar with the quirks.

  • It is possible, but quite a bit of a roundabout method. Any particular reason you need to use XML?

    Here is a rough idea of the steps:

    Import your XML file as a project file. https://www.scirra.com/manual/141/files

    Load the XML file into memory with AJAX.request. https://www.scirra.com/manual/107/ajax

    Access the data with AJAX.lastdata.

    Use tokenat() to parse the information you need from your XML file. https://www.scirra.com/manual/126/system-expressions

    Use the information you got to set the Sprite Animation, or to destroy and replace with another Sprite.

  • Here you go, see if this helps

    https://www.dropbox.com/s/gf5pnjr3jcrwr ... .capx?dl=0

    Use arrow keys to move, pin is automatic when you run over the black dot, and press E to drop it.

  • I think it is the wait that is stopping the event from updating the direction of the bullet. Try having the wait and stop in another event, maybe if Bullet is Moving - Wait 1, Stop Bullet by itself.