Eresor's Forum Posts

  • You need to get rid of the first code, it isn't what you want. Otherwise you'd have to post the project, as it isn't obvious what the problem is.

    I believe I said that I previously tried that, and when I did it would not "bounce" to other enemies, it sat on the same enemy that it hit.

    I will try to send you the game, just give me a moment

  • > You just need to find the closest non-hit enemy then.

    >

    > http://www.blackhornettechnologies.com/Construct3Stuff/Samples/DistanceBounce.zip

    I've tried around a bit now and it still somehow does not work.

    I've copyed your code, the only things that have been changed have been the instance variables to fit mine. Yet somehow something is wrong!

    I've tried deactivating the first code you sent me (like in your most recent code) I've tried putting some code over to the other, I've tried having both of them on, and I've tried everything in between, yet still it sometimes keeps targeting an enemy far away and other wonky stuff.

    It probably has something to do with the functions. I cannot add the function on shooting the weapon because of how I want the weapon to act. I may describe how I want the weapon to act very simply right now:

    I want it to shoot out fast projectiles quickly that go straight ahead (with the Bullet behaviour) and when they hit any enemy while any enemy is nearby it should then "bounce" or rather fly straight to said enemy. They will bounce a few times before destroyed.

    So by this description your code works quite well, and you've done a good job, but I do not see why it does not work for me.

    I'm so very sorry for bothering you so much, and I am extremely grateful for the amount of help you're putting into this, thank you very much.

    Do you have any other ideas to how this could work?

    I also forgot to add a picture of the code, so here it is prnt.sc/uowmq2

  • You just need to find the closest non-hit enemy then.

    http://www.blackhornettechnologies.com/Construct3Stuff/Samples/DistanceBounce.zip

    I've tried around a bit now and it still somehow does not work.

    I've copyed your code, the only things that have been changed have been the instance variables to fit mine. Yet somehow something is wrong!

    I've tried deactivating the first code you sent me (like in your most recent code) I've tried putting some code over to the other, I've tried having both of them on, and I've tried everything in between, yet still it sometimes keeps targeting an enemy far away and other wonky stuff.

    It probably has something to do with the functions. I cannot add the function on shooting the weapon because of how I want the weapon to act. I may describe how I want the weapon to act very simply right now:

    I want it to shoot out fast projectiles quickly that go straight ahead (with the Bullet behaviour) and when they hit any enemy while any enemy is nearby it should then "bounce" or rather fly straight to said enemy. They will bounce a few times before destroyed.

    So by this description your code works quite well, and you've done a good job, but I do not see why it does not work for me.

    I'm so very sorry for bothering you so much, and I am extremely grateful for the amount of help you're putting into this, thank you very much.

    Do you have any other ideas to how this could work?

  • You'd have to post your code at this point.

    prnt.sc/uov9j1

    Here it is!

    The code for the projectile is mostly your code and destroying the projectile

  • Drag the enemies around to see them check if distance is within 200 pixels. The example will just draw lines both ways as there is no optimization to check if a line exists already, but you get the idea.

    http://www.blackhornettechnologies.com/Construct3Stuff/Samples/DistanceWithinFamily.zip

    Alright, so I used your mechanism and it seemed to work quite well, however I have to problems, and they're probably due to me and not you.

    1: Sometimes the projectiles of the weapon seem to target an enemy really far away instead meanwhile some enemies could be a lot closer (not close enough) and not get targeted. How come?

    2: Sometimes the projectiles target the enemy it first hits.

    I use the MoveTo behavior to move the projectiles to the other enemy that is being scanned for (if that makes sense) otherwise the bullet behavior is being used at the start. The problems probably have something to do with the MoveTo mechanic, however I do not know why

  • Drag the enemies around to see them check if distance is within 200 pixels. The example will just draw lines both ways as there is no optimization to check if a line exists already, but you get the idea.

    http://www.blackhornettechnologies.com/Construct3Stuff/Samples/DistanceWithinFamily.zip

    I think I might understand this concept. I will try it in my own game and then report back to you, thank you very much for your help

  • There's various ways of doing this. Cache the first coordinates, and compare those to the other enemies, or have a second enemy family, so you have two unique objects to check.

    That first option sounds like the better one. How do I do that?

  • You provide the points of the two objects you are checking.

    if( distance(Enemy1.X, Enemy1.Y, Enemy2.X, Enemy2.Y) < 50) do something.

    I see, but I want it to be in the Enemies family, which means that I want any enemy to be checked, this includes the same type of enemy. Should I then just do distance(EnemyFamily.X, EnemyFamily.Y, EnemyFamily.X, EnemyFamily.Y) ? This seems not right due to the fact that they just repeat the same thing. Am I misunderstanding?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use the distance() expression.

    https://www.construct.net/en/make-games/manuals/construct-3/system-reference/system-expressions

    I'm not the brightest so I just need to ask: Should I for example just do distance(-200, -200, 200, 200) ?

  • So I have this weapon in my game that shoots these lightning bolts, and I want it to bounce from one enemy straight to another if they are close. Problem is that I don't know how to this.

    I've tried using invisible big circles and pinned/moved/containered them to the enemies, problem is that they stack on top of each other.

    I've tried Clamp, but I don't quite understand how that works.

    It would be nice to do it without using the sprites, but any help at all is welcome and appreciated!

  • You know the design of the game but I don't know so i'm not sure what the clicking of the placeholder squares is meant to do across the different bars. Global variables are for setting values used throughout the game such as player hp. You can use these for player upgrades, one for left and one for right

    Alright I'll try to do something with these global variables

  • Hmm with the file I'm still not quite sure because it's in a test state. It seems to be very visual though relying on objects. You could use global variables to determine if something is equipped on the left or right of the player. And then you can use another variable for type, so equippedleft=Claw, equippedright=Claw etc. I don't quite understand the interface and the clicking and equipping but I would use variables anyway.

    What do you mean by test state?

    And how exactly do these global variables work? I've never used them

  • > Weapon equip should be really simple. I looked at the screenshots and events and still don't know what's going on really. Better to send the project file or explain how the system works and can come up with a better way of implementing it.

    Alright, here's a link to the file, I hope I did this sharing thing right, haha

    https://drive.google.com/file/d/1_3A062_GAV1xR_6_9oGyh1m2ygmzqiws/view?usp=sharing

    Also, I might add that there are some things there that was mostly used for testing and that don't do anything, so just ignore those

  • Weapon equip should be really simple. I looked at the screenshots and events and still don't know what's going on really. Better to send the project file or explain how the system works and can come up with a better way of implementing it.

    Alright, here's a link to the file, I hope I did this sharing thing right, haha

    drive.google.com/file/d/1_3A062_GAV1xR_6_9oGyh1m2ygmzqiws/view

  • So it's a bit hard to explain, but I'll try the best I can. I want to make a game in which you play as this ship and you have two cannons. Now you can equip different weapons on cannons, or the same one on both of them. I'm kind of struggling with doing so. As you can see from these screenshots prnt.sc/ulmynj prnt.sc/ulmyww I've made it so that when you click on the little box some buttons will pop up. One for equipping the weapon on the left, one for the right, and one for both of them (haven't made the both button yet)

    Now the problem is that most of the time when I'm trying to equip a weapon it seems like it's random what it does, and it's annoying me a lot as it's hard to find out what's wrong.

    Here is my event sheet for this layout, and on the bottom is a pic of the layout itself

    prnt.sc/uln154

    prnt.sc/uln1h0

    prnt.sc/uln2n7

    I should also point out that the layers Player, and Background has a parallax of 0, while Menu is normal, and the normal weapons on the left are on the Player Layer

    So I feel like the problem has to do with me selecting the weapon that's the closest to the Mouse, however I do not know how to do it otherwise

    I've struggled with this for some days and I could really need some help, thanks in advance