YesNoOk
avatar

How do I save the "pos x" values ​​ (Read 14759 times)

Started by ryuhoshi490, November 05, 2024, 02:48:21 am
Share this topic:
How do I save the "pos x" values ​​
#1  November 05, 2024, 02:48:21 am
  • **
    • Colombia
    • arfercon@gmail.com
I ask from my ignorance.
I have an explod that is created in the position of p2 (explod1). And I need to create another explod, in another statedef, but in the same position as explod1, regardless of whether p2 has already changed position.

explod1 uses "postype = p2" but it doesn't work to use the same value for explod2 because p2 has already changed position.

How do I save the x values ​​of explod1 to use them in explod2?
Re: How do I save the "pos x" values ​​
#2  November 05, 2024, 04:34:06 am
  • ****
  • Formerly DeathScythe
    • Brazil
    • lyricasky.neocities.org
You can set a variable.

Code:
[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(5) = EnemyNear, Pos X

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(6) = EnemyNear, Pos Y

Then spawn the explods based on the variables:

Code:
[State 0, Explod]
type = Explod
.
.
.
pos = var(5), var(6)
postype = left
.
.
.

I can't remember exactly but I guess you should use postype = left in this case. Try experimenting with it.
Re: How do I save the "pos x" values ​​
#3  November 05, 2024, 06:24:53 am
  • **
    • Colombia
    • arfercon@gmail.com
thanks. I tried with those values, ​​but I can't get them to be accurate enough.
Re: How do I save the "pos x" values ​​
#4  November 05, 2024, 01:04:12 pm
  • ****
  • Formerly DeathScythe
    • Brazil
    • lyricasky.neocities.org
By the way, I read your post again and noticed you only need Pos X and not Pos Y, so you can ignore the second varset.
Maybe the position is not accurate because of the triggers you're using in the varset, or even the placement of your varset. You need to place the varset before the explods. Also make sure the var is not being used anywhere. Lastly, make sure the trigger for the varset is correct. I gave you an example which you should change according to your own needs.
Re: How do I save the "pos x" values ​​
#5  November 08, 2024, 02:11:49 am
  • *****
  • Shame on you!
    • USA
This sounds better suited for a helper instead of an explod.
Spawn the helper the same way you spawn the explod. Then in the helper, you could make it's animation be the first explod, or it could spawn an explod immediately and then wait for the 2nd explod's conditions to be met to make a 2nd explod.
You could set up a destroyself after 400 tics or when both explods are finished
vVv N00bSaibot & Muramasa RoofTop vVv