otoduran's Forum Posts

  • Hello. Here I'm going to ask how to create a chain lightning effect and answer it myself with what i managed to accomplish since i looked everywhere and could not find anything on how to create chain lightning on construct.

    Ill link my test project on git hub too.

    I hope this helps anyone else who gets stuck on something like this in the future.

    Here is the test project.

    https://github.com/otoduran/construct-3-chain-lightning-test

    And here is the code.

    [chain lightning]

    ----+ Mouse: On Left button released

    ----+ timerGun: [X] Is Timer "cd" running

    -----> player: Cast LineOfSight ray from (Self.X, Self.Y) to (Mouse.X, Mouse.Y) (use collision cells True)

    -----> Audio: Play pickupCoin.webm not looping at volume 0 dB (stereo pan 0, tag "")

    -----> timerGun: Start Timer "cd" for 1.0 (Once)

    --------+ player: LineOfSight ray intersected

    --------+ System: Trigger once

    ---------> System: Create object lightningspell on layer 1 at (player.LineOfSight.HitX, player.LineOfSight.HitY), create hierarchy: False, template: ""

    ---------> player: Spawn lightning on layer 1 (image point 0, create hierarchy: False)

    ---------> lightning: Set angle toward (Mouse.X, Mouse.Y)

    ---------> lightning: Set width to distance(Self.X, Self.Y, mouse.X, mouse.Y)

    ------------+ lightningspell: Is overlapping enemy

    ------------+ enemy: Pick nearest to (lightningspell.X, lightningspell.Y)

    ------------+ enemy: beenhit = 0

    -------------> Audio: Play energyPickup.webm not looping at volume 0 dB (stereo pan 0, tag "")

    -------------> enemy: Spawn lightningDetector on layer 1 (image point 0, create hierarchy: False)

    ----+ lightningDetector: Is overlapping enemy

    ----+ enemy: beenhit = 0

    ----+ System: charges > 0

    ----+ System: Trigger once

    -----> System: Wait 0.08 seconds

    -----> Audio: Play sfxhit1.webm not looping at volume 0 dB (stereo pan 0, tag "")

    -----> enemy: Spawn lightningDetector on layer 1 (image point 0, create hierarchy: False)

    -----> System: Subtract 1 from charges

    --------+ (no conditions)

    ---------> Audio: Play swing1.webm not looping at volume 0 dB (stereo pan 0, tag "")

    ----+ System: charges = 0

    -----> System: Wait 0.11 seconds

    -----> System: Set charges to maxCharges

    ----+ System: [X] charges = 3

    -----> System: Wait 0.4 seconds

    -----> System: Set charges to maxCharges

    ----+ enemy: On collision with lightningspell

    -----> enemy: Set beenhit to 1

    -----> enemy: Start Timer "gothit" for 0.2 (Once)

    ----+ enemy: On collision with lightningDetector

    -----> enemy: Set beenhit to 1

    -----> enemy: Start Timer "gothit" for 0.2 (Once)

    ----+ enemy: On Timer "gothit"

    -----> enemy: Set beenhit to 0

    ----+ System: Every tick

    -----> player: Add LineOfSight obstacle enemy

    -----> player: Set LineOfSight range to 600

    -----> player: Set LineOfSight cone of view to 0.1

    -----> lightningspell: Fade: set fade-out time to 0.1

    ----+ lightningDetector: On created

    -----> lightningDetector: Add LineOfSight obstacle enemy

    -----> lightningDetector: Set LineOfSight range to 300

    -----> lightningDetector: Add Turret target enemy

    -----> lightningDetector: Set Turret rotate speed to 20000

    -----> lightningDetector: Fade: set fade-out time to 0.1

    -----> lightningDetector: Set Turret range to 300

    -----> lightningDetector: Set Turret rate of fire to 1

    -----> lightningDetector: Set visibility Invisible

    --------+ enemy: [X] beenhit = 1

    --------+ enemy: Is overlapping lightningDetector

    --------+ enemy: [X] Is overlapping lightningspell

    ---------> lightningDetector: Spawn lightning on layer 1 (image point 0, create hierarchy: False)

    ---------> lightning: Set angle toward (enemy.X, enemy.Y)

    ---------> lightning: Set width to distance(Self.X, Self.Y, enemy.X, enemy.Y)

    ----+ System: For each enemy

    ----+ lightningDetector: Is overlapping enemy

    ----+ System: Trigger once

    -----> (no actions)

    ----+ enemy: beenhit = 1

    -----> (no actions)

    ----+ lightningspell: On created

    -----> lightningspell: Set visibility Invisible

  • Fixed the issue with the sprites disapearing.

    The sprites were in the UI layer. maybe the parallax was sending them to heaven.

    But on layout 1 they were on the UI layer and it worked...

    anyway taking them out of that layer fixed it.

    On to the next mess. =D

  • + System: CraftingMenu = 1

    -> System: Wait 0.01 seconds

    -> Ammo1ICON: Set position to CraftMenu1 (image point 1)

    -> Ammo2ICON: Set position to CraftMenu1 (image point 2)

    -> Bomb_ICON: Set position to CraftMenu1 (image point 3)

    -> Bot1_Icon: Set position to CraftMenu1 (image point 7)

    -> Repair_Icon: Set position to CraftMenu1 (image point 9)

    -> Ammo1ICON: Pin Pin to CraftMenu1 (X: True, Y: True, angle: False, width: No, height: No, Z: False)

    -> Ammo1ICON: Set Pin destroy with pinned object True

    -> Ammo2ICON: Pin Pin to CraftMenu1 (X: True, Y: True, angle: False, width: No, height: No, Z: False)

    -> Ammo2ICON: Set Pin destroy with pinned object True

    -> Bomb_ICON: Pin Pin to CraftMenu1 (X: True, Y: True, angle: False, width: No, height: No, Z: False)

    -> Bomb_ICON: Set Pin destroy with pinned object True

    -> Bot1_Icon: Pin Pin to CraftMenu1 (X: True, Y: True, angle: False, width: No, height: No, Z: False)

    -> Bot1_Icon: Set Pin destroy with pinned object True

    -> Repair_Icon: Pin Pin to CraftMenu1 (X: True, Y: True, angle: False, width: No, height: No, Z: False)

    -> Repair_Icon: Set Pin destroy with pinned object True

    This works perfect on layout 1.

    on layout 2 it just doesnt. only 2 of the sprites show up...

  • Fixed one of the objects spawning problems just by moving the event out of the groups... didnt know groups affected the events that much.

  • > other stuff will spawn 2 times instead of 1.

    Check that these objects are not set as Global.

    > another 20 stuff go BOOM BOOM.

    The most likely reason stuff goes BOOM BOOM is that you made a boo-boo programming it :) Unfortunately this is all I can tell you from the information you provided.

    haha i figured that out. im starting to think ill just have to start from scratch.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im wondering why would changing layout make almost half of my event sheet go BOOM BOOM. second layout is a duplicate of the first one. and suddenly some stuff wont spawn for some reason. other stuff will spawn 2 times instead of 1.

    it completely broke the game im making.

    I manage to fix some of the stuff but man. its chaos. i fix something and another 20 stuff go BOOM BOOM.

    If i can get a general reason why things would stop working. maybe i could fix it. but i got no clue as to why.

    or if anyone suggest any way i can design stuff so that this doesnt happen ?

    when i watch tutorials on changing layouts, everyone does it so simple, its baffling.

  • Finally i understand how arrays work. much like battleship board.

    And i used your help to make it work.

    What i really needed was to clear x axis at y=0 and for the other side clear x axis at y=1.

    Thx for the help.

  • This will clear X axis at Y=3

    For "n" from 0 to (Array.width-1) : Array Set 0 at (X=loopindex, Y=3)

    This will clear Y axis at X=3

    For "n" from 0 to (Array.height-1) : Array Set 0 at (X=3, Y=loopindex)

    Is not working. Obviously im doing something wrong. Trying to figure it out.

    Thx for the info. ill try making it work.

  • 0,1

    1,0

    0,0

    If that's an array, how can i clear Y axis without touching the X axis ?

    or clear the X axis without touching the Y axis ?

    i want X axis to have only one "1" at a time and same for Y axis.

    so far i can only clear the whole thing. but not just one of the axis.

  • hello

    you can pick the correct object two ways,

    using containers will auto-pick the correct object

    or

    when one object creates the other

    store it's UID in an instance variable

    that way you can pick by UID later

    Hello thx for the info. i had forgotten completely about the containers and didn't know you could store the UID when a object spawns another.

    I got it to work as i wanted using the pick instance overlapping thing like i show on my last image.

    Thx a ton for the help. =D !

  • Fixed it finally. Now the animations work individually with each animation object pinned to the enemy object.

  • I think the problem is the animation is in a separate object.

    The action doesn't know what instance of that object its referring to.

  • Tried this now and wont work T_T

  • i have it like this now and its doing the same

    enemy1 is the object that has the animation object pinned to it.

  • Add to the top conditions another system condition 'for each enemy'

    ty for the suggestion.

    I added it as you said and its still doing the same thing.

    added it on each path finding condition and on condition on top of them all.

    still when they face different directions it stops animating.