Another rotating thread - rotate a stick by its one end

HunnenkoenigHunnenkoenig Member Posts: 1,173
edited November -1 in Working with GS (Mac)
Ok the title is a bit confusing, but I couldn't explain it in another way.
What I want to do:

An UFO is hovering above the city and it shoots laser beams to the ground.

I want to place the beam to the screen, fixing its one end to the "cannon" of the UFO and make its alpha to 0.

Now let say every 3 seconds I set the alpha to 1 so the beam is visible and I want to rotate it randomly, so it looks like it shoots in different directions, but I want one end always fixed to the UFO, so only the bottom end of the beam hits the ground in different positions.

I looked around but I found only 11 month old threads. I assume, I should work with "Rotate to Position", but I don't get it how it works.

Comments

  • rebumprebump Member Posts: 1,058
    See my profile's "chainsaw" and/or "lightsaber" demo projects that I fixed up for UtopianGames. Your UFO would be the green actor in the "chainsaw" demo or the dark robed jedi in the "lightsaber" demo.

    This is assuming the laser beam being shot down is like a baseball bat arc down into the city (sort of like the lasers tearing down the streets in the Tom Cruise starred remake of "War of the Worlds").

    If you just need a short laser burst that follows another actor, I think there is a "follow actor" or "follow me" demo in JCFord's profile.
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Thanks rebump, I will look at it.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    also my magnitude demo...
  • rebumprebump Member Posts: 1,058
    Yeah, FMG's magnitude demo would be great if you want the laser beam to vary in length and flow from the bottom of the UFO to street level no matter how far up and down the street it goes. You will want to grab the part of his demo that draws the connecting lines between the balls. I think you will want to do that for a great effect.

    (awesome demo by the way FMG)
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Ok, thanks guys!

    My head is already exploding, so I will look at it tomorrow.
    Now I didn't understand a word from those projects :-)

    I think, I will figure it out somehow tomorrow :-)
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Ok, I am dumb.

    Can somebody help me how to start this?
    I don't understand those sin and cos and angle here and angle there in those projects.

    I don't want to move my laser beams, they should only change angle fixed on one end.

    If somebody could only make me a small demo, where a vertical stick's bottom end moves from left to right in a 45° angle, where the top end is fixed, I would be very happy.

    I am an idiot with math and my english is also crap and about programming I have no clue...
  • rebumprebump Member Posts: 1,058
    Take FMG's demo and remove one of the balls that are of the matching pair. Then with the two balls left over, one is your UFO...keep it floating about up top...the other, replace it with some ground based actor that only moves left and right. Then modify the "line connecting" logic to happen no matter what the distance (or at least enlarge the distance the effect occurs at) and have it trigger not on distance but upon "fire" (whatever determines that in your game whether it be a key press or some other event).
  • homelesswombathomelesswombat Member Posts: 73
    You could create a .png that is really long and skinny, with half of it transparent and half with your yellow laser beam. It would just look like an actor rotating with an offset center point, when in reality there is a transparent part of the actor above the UFO. I bet that is how they did the cannon in Kill the King.

    The only problem with this solution is if you don't want things above the UFO to collide with the laser, you're out of luck. But if it's just hovering at the top of the screen and all the player interactions are below, collisions work just fine.
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    I did, what rebump mentioned and It works!!!

    Yeehaaaa!

    I first used FMG's demo and tested it.

    Then I created two invisible images. One is positioned on the ufo and doesn't move, the other jumps every second to a random location in a certain area (change X to random(0,320) and change Y to random(0,100) ) and the beam appears whenever the jumping actor sets an attribute to true. The jumping actor sets it to false after 1 second.

    Now my UFO shoots laser beams everywhere on the ground.

    It looks sooooo cool!

    Thanks guys!
Sign In or Register to comment.