InfiniteRockets's Forum Posts

  • Okay, that's really helpful - thank you. Before I go down the path of replacing the Lerp recoil events with Tweens, I just wanted to ask whether you thought they would allow me to implement the recoil more or less as it functions now (ignoring the cycling values from the Lerp of course!)

    Something that I have working at the moment is that if the player shoots in rapid succession, the recoil throws off the aim (which is intentional). If I get a Tween working, is it possible to 'interrupt' the animation so that it works in this way?

  • Ahh, thank you for the insight - the event order makes a lot of sense, I'll restructure the events so that the execution order is logical.

    I've also just noticed the continually changing values for both of the Recoil values. Are you able to suggest changes to the events that would alleviate this? They're both supposed to return to 0. The recoil events are probably the ones I've struggled with most!

    Any help is massively appreciated.

  • Just an additional question; any idea why occasionally my objects aren't destroyed based on my current set of events? Everything looks like its set up properly, but I can't work out what is periodically causing the blocks not to get destroyed when it looks like the conditions are met. I've uploaded the whole project if anyone can help.

    https://www.dropbox.com/s/t5o0xncy402f1kb/RayHit.c3p?dl=0

    This is what I'm currently seeing; I've also tried removing the ammo variable check. The right instance seems to be selected (i'm outputting it to a debug box in the top left corner).

  • Brilliant, thank you very much!

  • I'm trying to set up a condition whereby when an object is intersected by a ray (and the player pushes a button), that specific instance of the object is destroyed. I have been able to set this up so that all instances of the object get destroyed, but not on a per-object basis. Is the best way to do this with UIDs, and if so, what would the event structure look like? My ray is otherwise working as intended and has a pretty straightforward setup, though I can post events if this helps.

  • This is great, thank you so much for the explanation, it really helps me to understand how the events work - I’ll try your suggestion tomorrow.

    I’m definitely not married to this particular approach, I just observed from the recoil events I was using elsewhere that I might be able to repurpose it. I’m totally up for trying a different approach, especially if you think this way might lead to technical headaches later on. Not sure if you can suggest something? Maybe I overcomplicated this and should have tried something with vectors or Bullets instead?

  • I’m trying to implement a shield bash move, which acts a little bit like a spring; when the player holds down the trigger, it draws the shield toward them. When they release it, the shield quickly surges forward so incoming projectiles can be batted away in a timed fashion.

    I’ve managed to get the basics of movement (i.e. preloading and unloading the shield) working with some events lightly adapted from dop2000 's recoil tutorial, but I’m having some difficulty in altering some of the maths functions. I’m generally happy with the trigger down movement that moves the shield towards the player.

    The lerped release is what’s confusing me; how can I alter this so that the shield quickly surges forward to its original position rather than slowly settling back into place?

    Again, I’m trying to get this to behave like a spring (or a bow string) where there’s a slower draw back and then a quick, strong release. Is there a way to have it momentarily shoot past its starting point on release a bit like a spring? I realise this might be getting into easing which is definitely beyond my ability at the moment!

    Is this even the best approach for this kind of action? Any code/events/suggestions are greatly appreciated. I've uploaded the project in case that's helpful too.

    https://www.dropbox.com/s/r46z9ma2usqrhpo/ShieldBash.c3p?dl=0

  • Hmm, perhaps I'm not understanding the logic - shouldn't the last part of the function return the WeaponSelect variable to 0? Or is that not possible, because as soon as the button is pressed, it's triggering the event which adds 1 and activates the function again (i.e. after the first use, there are currently no conditions which return it to 0 without the same button press adding 1)?

    The intention is to have the first weapon (i.e. the handgun which = WeaponSelect 0) spawned in at the beginning of the game, though obviously this can't use the Right Button event so I'm using a separate condition to do this separate from the Function.

    I see an easy fix in just assigning the weapons to 1, 2, 3 etc without using 0 as you suggested and then just change my other conditions - but I can't currently figure out a way to do it more elegantly using the weapon switch function or use 0.

    I've uploaded a current version of the project here in case anyone can suggest a way to do this: -

    https://www.dropbox.com/s/clbq6141tbk8d8m/WeaponSwitch.c3p?dl=0

    Again, thanks for your help with this, it's helping me to get my head around a bunch of concepts.

  • Amazing, thank you! Switched that around and now it works perfectly.

  • I’m outputting the value of WeaponSelect to a text box; it starts on 0 because that’s the initial value, but one the function is initiated, it never loops back to 0 as per the last event. I also have some events based on the value being 0 that aren’t activating.

  • Amazing, thank you so much - I got this mostly working using functions (and now I understand a bit more about use cased for functions, so thank you for that too!).

    The only thing I'm running into is that the function doesn't cycle back to 0 - once initiated, it adds one every time, but seems that when WeaponSelect gets to 3, it doesn't set itself back to 0. This seems like it should work, but am I missing something about the logic?

    One final question - because of the globally accessible nature of functions, is it always necessary to use globally scoped variables (i.e. like WeaponSelect in your example)? Previously, I had been using a local variable attached to the player - I expect that using this in other parts of the game would lead to issues?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I got this working perfectly using the advice that you both posted; again, thank you very much. As I suspected, it was my understanding of execution order that was tripping me up. I do have a question more for my own learning/understanding than anything else. I used the following events to get everything working, including the player cursor not skipping to 0 degrees when spawned. You can see that as suggested, I've specified the angle of creation on object spawn: -

    However, I also managed to get it working without specifying the angle on object spawn when the events were in the order below. As soon as I move the events into my Player Management group, it skips back to 0 degrees before adjusting to the angle stored in my variable. What is it about the execution order that has changed which causes that to happen?

    And just one more question; the Else event works really well for switching back and first between two weapons/variables, but could it also be adapted to having 3 or more weapons/variables (i.e. hitting RB on the controller cycles between 0, 1, 2)? Or am I looking at a completely different approach for that?

    Thanks for your help!

  • Amazing, thank you both so much - I'll try both approaches and report back if I still have any difficulties. I hadn't considered hiding the objects for some reason!

  • I'm working on a simple weapon switching mechanic whereby the player is able to switch between two physical objects; a gun and a shield. The way I invisioned the logic working is that when the player hits right bumper on their controller, it destroys the current weapon and replaces it with a different one at the same position.

    I have managed to get this working in a pretty janky manner, but it's giving me some issues which have probably got something to do with the general logic and order that I'm issuing events. The major problems I have are;

    1. I can't get my events to work with the same button (i.e. Left Bumper) - I have to switch each weapon to a separate button for it to switch back and forth. I'm assuming this is something to do with the structure of my events, and there's a way of approaching this that I'm missing.
    2. When the weapon switching is working with the adjustment I mentioned above, the positioning seems glitchy. When the new weapon object is created, it reads its angle from a global variable (i.e. the left stick's last reported position) yet it seems to momentarily reset to directly in front of the player.

    Here are my events, and I've also posted the project. Thanks for any help you can provide.

    https://www.dropbox.com/s/clbq6141tbk8d8m/WeaponSwitch.c3p?dl=0

  • Brilliant, that worked - thank you so much.

    Can I also ask, if I want to create a larger radial movement independent from the linear movement, would an approach be to create a second variable on the gun object (i.e. RadialRecoil) and then simply adjust the clamped value? Or is there something else that I'm missing?