Phyvo's Forum Posts

  • Hmmm... my best thought is to make a sprite for your line. Make sure the sprite's origin point is at one of the ends of the sprite. You'll actually use two sprites with instance variables to "grow" the line with their origin ends touching and the "lines" facing opposite angles. Then use something like "Every tick - if Line.isgrowing - set Line height to Line.height+300*dt" to grow the lines. Then make a separate event for when the lines finally collide or overlap with one of your solid object and in there you set Line.isgrowing to false.

    edit: note the "dt" is just to make your lines not grow faster/slower when your framerate changes and makes inserting a pause function easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes. Create an instance variable for your object named something like "hasjump". Give your jump event a condition that "object.hasjump" = true, and in the jump event set "hasjump" to false. Then use the platform on landing trigger to set "hasjump" to true again.

    If you use a number instead of a boolean this is also how you can give characters multiple jumps in a platforming game.

  • Well to be honest I've found the sprite/animation editor functionality in Construct to be pretty bad, you're much better off handling sprites in 3rd party programs and then importing them. But you're already stuck so here's the best thing I think you can do:

    First of all, make sure your file is saved as a .caproj, not a .capx. This way your project is multi-file and by navigating to your project file you can find your images in its Animations folder. Back it up to somewhere else on your hard drive. All your image files are in nested folders first under the name of your sprite and then under the name of the animation.

    Now inside construct rclick in the "Animation frames" window and use "Import frames" to import the correct frames from your back up folder into the correct animation. You can select multiple files at once to speed things up a little. Now delete all undesirable frames/animations from within construct and continue this process until you're done.

    Note that you *have* to do importing, frame addition/deletion, and animation addition/deletion within Construct. Construct doesn't react to filesystem changes unless you're replacing an image your project is already using.

  • Yeah my assessment is correct. If you set the stopping condition to be less than 400 speed the first frame of "leftstop" plays the whole time. This is because holding the button causes "left" to play but then later in the event list the stopping event checks for "left", sees "left" and causes "leftstop" to play instead, doing this within every single tick, leaving you stuck on frame 1 of "leftstop" until you release the button or exceed the speed set in the stop event. The stop animation works if you let go of the button because the game stops trying to play the "left" animation.

    Playing leftstop on key release is actually a great idea. It should solve your problem since it will make it impossible for the game to try to play both animations at the same time.

  • This is what it sounds like is happening, correct me if I'm wrong:

    Any time the speed is below 100 *and* a moving animation is playing, the game begins to play the stop animation. So when you slow to a stop you're fine because you go below 100 speed and play the stopped animation once. But if you start moving again the game will try to play the moving animation again when the object is still under 100 speed! This causes the event to trigger again, playing the "stopped" animation from the beginning.

    I can't really give you a precise solution because I don't know how you have your animations set up, but if my assessment is correct the solution is to make sure your moving animations don't fire unless the object's speed is greater/equal to 100.

    Also, if you use a free file hosting service like drop box to host a single file capx of your project it makes helping you a lot easier. Screenshots are less ideal but can work too. Without either it will be hard for me to help you further if my idea doesn't work.

  • The reason why this isn't working is because of event #3. Currently that event happens every tick that the hero isn't moving regardless of other animations that might be trying to play. So you start the attack animation but it's immediately overridden with the standing animation one tick later (too fast for you to see).

    To fix this all you have to do is add another condition to #3 saying "Hero is playing 'Atacando'" and make it the inverse. That way if the attack animation is playing the standing animation won't override it.

    Now, in order to change the attack animation back when it finishes make another event, specifically "Hero - animations - On Finished" and use that to change the animation back to the standing one.

  • Your loop is actually running 11 times (because there are 11 numbers in a list of numbers from 0 to 10). You just can't see it because you're spawning all the enemies on top of each other instantly as Vee said. To better see what your setup does add a "wait loopindex*0.1 seconds" action to your loop and put "add 1 to current enemy count" immediately before the wait and your "create object one" action immediately after the wait.

    One note about the wait function in loops: wait operates in parallel, that is, if you had "wait 0.1 seconds" in a loop your loop would just create all 11 objects 0.1 seconds later. In order to have each repeat wait a different time you need the loopindex variable.

  • Simply texting for the x position to be the same is unlikely to work because Construct can only test an object's position so many times per tick and moves objects multiple pixels at once.

    I see two main solutions for this.

    Probably the more elegant one is to, once it's overlapping, predict when it's going to cross the next tick using dt (there's more information on that if you search the manual). dt times its speed X vector will give you the number of pixels it will move on the next tick. With this you can then test it's approach from the left side using if ((stopper.X - bullet.X) < (bullet.VectorX*dt) and stopper.X > bullet.X), with another modified expression for if the object is approaching from the other side (stopper.X < bullet.X). If true you then set its speed to 0 and use set X to put it in exactly the right place.

    If you're really not comfortable with expressions (though I suggest you do get comfortable with them at some point), another solution would be to create two new invisible objects 1 pixel wide that mark the left and right sides of the stopping object. When the bullet collides with the invisible objects with the correct trajectory (VectorX < 0 for the left one and VectorX > 0 for the second one) you then force the bullet into the precise position (with set position X) and set its speed to 0.

    I hope this helps!

  • Uh, just a note, I screwed up saved over my latest capx so the file lacks the scoring system, so questions 2 and 3 are kind of moot. I'd still like to know what to do about nonstatic function parameters and the unhelpful behavior of local variables though.

  • I have been working on stuff with Construct 2 for several days, forgive me, I have SO MANY QUESTIONS.

    1. I can't get enemies ("Sprite") to home in on what the player's ("Sprite2"'s) position was 2 seconds ago (instead they continuously move straight towards the player). I was hoping to do it with local variables but they appear to not be unique across multiple instances of the same event.
    2. When the player jumps on an astronaut text is supposed to be created showing how many points you got for the jump. I've narrowed this down to my "PointKillDisp - set text to" action (disabling it removes the problem) but have no idea how it's causing it.
    3. When the player jumps on consecutive enemies a multiplier text object (named "Multiplier") appears to show their bonus. It's supposed to change color randomly and rapidly but the wait action, loop events, and perhaps picking mechanics continue to be an enigma to me.
    4. This is not in my project file but I think the question is simple enough. Is there a way to make function parameters "static" like you can with local variables? In a different project I had a function using wait actions to rotate a sprite over time and I had to set every parameter to a static local variable to make it work. Given problem #1 this could be a major problem if multiple instances of the function are called at once.

    Thank you very much for your help. I used to do some very basic programming in python but a lot of this event stuff is not very clear to me.

    dropbox.com/s/w615hjt3tdz027j/mygame.capx