Smileh's Forum Posts

  • Various ways to do this. Here's one.

    http://www.blackhornettechnologies.com/Construct2Stuff/TimedFire.capx

    Start with an initial delay, that offsets the firing, then switch to the firing period.

    That works nicely. Thank you very much blackhornet!

  • Not sure what you mean by domino effect. 1 then 2 then 3 then 4 and repeat?

    Exacly. One after each other creating a sequence. Or even 1 and 3 shotting at the same time and 2 and 4 at the same time.

    Because the timer wont create a sequence like I would like to have. I might have 4 turrets shotting at the same time, sometimes 3, sometimes just one, depending on the timer.

  • Explain what's missing.

    blackhornet

    Here's the example given in this thread applied to my game.

    The numbers represent each Tower Timer. As you can see, it doesn't work as expected, since it doesnt follow the timer as it should and the most imporant stuff: It shoots random NON-TIMED bullets.

    The real bullets should be the blue ones, since they're the ones which I set the animation too. The other ones are being created randomly I have no idea how, since the ones I'm creating are set to the blue animation.

    Also as you can see I set the degrees to 90, and it has been working in all my examples, but not on the example given. Not to mention the fact that using a behaviour to control something is not as effective as controlling it through events.

    EDIT: Added For Each on the On Timer and it seems to fix some of the problems.

    Furthermore. I think what I want to achieve is more like a Linear shooting. Something like a domino effect. How can I achieve that?

  • Aphrodite 's example is exactly what you need. You should post an example of how it doesn't work for you.

    It doesnt suit my purpose. Not saying it doesnt work, I'm saying it doesnt meet my expectations and controll over it.

  • Yeah, it doesnt work as I expected. I need more controll over it, something similar to what I'm doing, but I'm missing something to make it work.

    This is quite close to what I'm aiming, the problem is, it only works for one tower. If I duplicate the sprite a few times it doesnt apply to every object, just to one.

  • 1drv.ms/u/s!AjkoCSebIn9JixGkmfKK87AMBeBp I changed it so it uses an instance variable (called fire_timer) to have the 2 towers shooting at a different pace.

    maybe you can work out with that.

    Yeah maybe I can work with that, will give it a try, thanks!

    But still I would like to see an example without the timer behaviour..

  • you might want to check the timer behavior for your towers rather than using the wait action.

    https://www.scirra.com/manual/167/timer

    I've made a quick exemple (I added a rotate effect with the rotate behavior just for fun) https://1drv.ms/u/s!AjkoCSebIn9Jiw8M5tPJp_4lOs7g

    Nah, that doesn't do the trick. Each tower needs to have a different timer, that's why the variable.

  • I'm trying to make an static tower. The tower has a timer variable so my idea is to wait tower.timer seconds and then shoot.

    I thought this was gonna be really easy but I'm getting problems. Either I get the tower shooting infinite bullets nonstop or just shotting the very first time without repeating the "wait loop".

    I was going for something like:

    For each tower > Wait tower.timer seconds > Spawn bullet. This has to happens only once while true, otherwise it will endlessly shoots bullets nonstop, but if I set once while true it will only do this once without repeating the timer countdown.

    Any help?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So if I set unbouded layout I end up with white margins at the edge of the screen. I don't know exactly how to fix this

  • If you are worried about management in the event to keep control of which is what. I did find out that if you can do a function here with a call back. If you name your room to a number or a name. (at this point id keep a journal to write down which room goes where.)

    Such as this place a variable on that invisible sprite label it to the room that you want to go to. Next create an event like this if player is overlapping the sprite have the action to be call function With parameter 0 to be the sprite's variable

    Next create a function go to layout by name (function.param(0))

    now you only have one event one function and one sprite to manage thousands of rooms (layout) transition.

    That's pretty much what I figured out to do. I just have one sprite and one code for everything BUT my question was if there was any way to avoid having one layout for each room (You mentioned the array I mentioned on metroidvanias but that's far too advanced for me).

  • Just have 1 invisible box. On collision go to 'next layout'.

    I do that in a way. I have one invisible box with a variable. The variable is the name of the layout, so I use go to invisiblebox.variable layout.

    Once again, that is not the problem. The problem is I will end up having way too many layouts, one for reach room. Like I said my problem is not layout switching, is keeping it efficient.

  • Yes you can use the save function aswell. You just have to set the instance variable (or animation frame <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">) of the object and then save the whole game state.

    If you use the save/load function you don't need to do that though, because it will save the whole state of the game.

    Here is an example capx with a working waypoint system:

    https://drive.google.com/file/d/0B7r2WY ... sp=sharing

    In my example you actually don't even need to use an instance variable. I just used the animation frame of the object (You can have an activated animation frame and a deactivated one). 0 is deactivated and 1 is activated.

    I hope this helps! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Thank a lot for the example. I heard pick nearest can cause performance issues, can I use a variable instead? I feel stupid. I figured out harder things and now simpler stuff confuses me lol

  • Smileh,

    I don't know if the UID of the object would work or not but I would add an instance variable to the checkpoint object. You can then give every checkpoint a unique ID (Value) which will be put inside the instance variable.

    When the player reaches a checkpoint, you can save the instance variable of that checkpoint in localstorage or simply with the built in save/load function.

    Then you just add a condition which checks every single checkpoint if it contains the saved value. If it's the same, that should be the last checkpoint and you can change its animation to active. Every other checkpoint can be set to the inactive animation.

    I hope this helps!

    Can I do this with the save/load function as well? I have no idea how to datastorage

  • Whats wrong with multiple layouts? What kind of problem you have?

    Just remember that you can set some layers as constans. For example hud. So you dont have to copy past them.

    Is not easy to organize the go to layout gates for each room, and I will end up having way too many rooms, which means way too many layouts. It's not really practical and I'm scared to run into some performance issues.

  • When making a sidescrolling game, all I can think of is everytime you leave the screen go to another layout. For a few levels that's alright but when you start to going further this becomes a nightmare.

    I've seen in the metroidvania gamekit from the scirra store a way to do this with 9patch and roomzones but that is way out of my league. I'm a total beginner and that's too advance for me.

    Are these the only two options?