Moving in an arc
jonmulcahy
Member, Sous Chef Posts: 10,408
I'm working on an update to Z is for Zombie, and I want my player to be able to toss a pipebomb to take out a large number of zombies. I'd like it to arc up 25 pixels from it's starting position, and land at it's same Y value about 100 pixels away. anyone ever try this before?
Comments
Look at it. The cannonball flies an arc.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I've got an actor called pipeBomb, in it I created two custom attributes, 'arc' with a default value of 1 and 'startY'
for rules:
change attribute self.startY to self.positionY (this sets the pipebomb's initial start value, needed to determine when it hits ground.
Rotate clockwise at 150 (give it a spin)
Arc:
while self.Arc = 1
move up at 150
OTHERWISE move down at 150
ArcTimer
after .25
change attribute self.Arc = 0
MoveForward
move right at 300
finally, the rule to cause the explosion
if self.Position.Y is < self.startY-10 (I subtracted 10 to make it hit ground)
spawn actor Explosion
after .1 seconds - destroy actor
It works pretty good, it looks like the play is lobbing the bomb, and when it hits the ground, explodes.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left