The Daily Click ::. Forums ::. Klik Coding Help ::. Laser beams (yet again)
 

Post Reply  Post Oekaki 
 

Posted By Message

Ecstazy



Registered
  04/01/2002
Points
  179

VIP Member
16th December, 2008 at 14:22:51 -

I searched around a bit and noticed this has been asked before, but I didn't find any definitive answer to that: I want to make a laser beam that is shot towards another object and continues till it hits an obstacle.

First I tried the draw object (I remember messing around with it when I wanted to make a laser sight to a gun in a top down shooter), but I can't seem to make it work and there aren't any examples for that extension, or so it seems, also from the replies in some threads I've seen it doesn't seem to be like a popular choice for that issue.

Then I found this thread: http://www.create-games.com/forum_post.asp?id=200133
I downloaded the example in the 3rd post and it seems to work nicely, it's based on altering the scales and angle of an active object, but I can't manage to (1) make it stop at obstacles; (2) shoot in the angle of where the player is.


Any ideas?
I like the way a laser beam was done in FIG, I sent an email to the creator hoping to get some tips, no reply so far.

 
Amongst Strangers
http://www.create-games.com/project.asp?id=1445

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
16th December, 2008 at 14:26:52 -

Like the one I did in Satan Sam, a horizontal or vertical beam that stops when hitting either an active of a certain qualifier or obstacle?

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Ecstazy



Registered
  04/01/2002
Points
  179

VIP Member
16th December, 2008 at 14:37:07 -

Yeah, kind of, but since it shoots from a fixed location to a moving player it can be in different angles as well and not just 0 and 90 degrees.

Edited by Ecstazy

 
Amongst Strangers
http://www.create-games.com/project.asp?id=1445

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
16th December, 2008 at 15:11:46 -

I use the same technique in my game, so i can make an example later today if you like.

You can see it in this pic:
http://www.nicandreb.f2s.com/2d8games/projectrollercoaster/pictures/supports4.png

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
16th December, 2008 at 15:15:27 -

Ah a full 360 degree thingeroo, I've no idea how to do that just yet so I'll go into the corner. That corner.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
16th December, 2008 at 15:17:30 -

It's quite easy, really && I learnt it in an afternoon

 
n/a

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
16th December, 2008 at 15:17:35 -

James, you just use the in built angle function in MMF

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
16th December, 2008 at 15:29:04 -

Example:
http://www.nicandreb.f2s.com/2d8games/examples/laserbeam.mfa

It won't be up forever so get it while it's hot. This technique does NOT make MMF a happy bunny unless run in HWA.

Edit 1:
Oh gosh how embarassing! I didnt actually read the last sentance in your post. You can do it without altering the scale, but not without altering the angle. Unless anyone wants to prove me wrong

Edit 2:
What is actually wrong with using the technique i used?

Edited by -Nick-

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

Ecstazy



Registered
  04/01/2002
Points
  179

VIP Member
16th December, 2008 at 19:34:30 -


Originally Posted by -Nick-
I use the same technique in my game, so i can make an example later today if you like.

You can see it in this pic:
http://www.nicandreb.f2s.com/2d8games/projectrollercoaster/pictures/supports4.png


Thanks, it works like a charm and now it feels silly that I didn't manage to do it on my own, though I said I did try scaling. I'm new to fast loops so maybe I did something wrong earlier...

One thing bothers me though, I set the quality to 0 and set the X scale in every loop to X scale + 1 instead of 0.5, and still the line was too short in 50 loops, but if I tried making it more than 50 loops it became VERY processor intensive.
Even on your sample I was already around the 60%-100% CPU load (depending on the angle) with my Athlon 64 3500+, how do you manage to pull off entire rollercoaster tracks with it?

Edit: About my last sentence, I'm not sure what you're talking about...

Edited by Ecstazy

 
Amongst Strangers
http://www.create-games.com/project.asp?id=1445

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
16th December, 2008 at 20:16:16 -

In my game it's only the supports that are created in this way, the track is rendered with an entirely different technique. Plus, MMFs HWA works wonders.

If you haven't got the HWA beta yet, download it. It makes scaling and rotating effortless for MMF.

Edited by -Nick-

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
17th December, 2008 at 06:24:01 -

I was making a game and then tried it with HWA and it wouldn't work properly
But apart from that, yeah it's good

Anyway, I found the laserbeam.mfa example pretty good and I've been meaning to add a laser feature to my game, I was going to add it later but since this topic is still nice and fresh I'll ask this question now:

How to make an object position itself at the end of the laser? Like a little crosshair or something so that you know where the laser will go when you shoot it... I've seen it done before but I can't remember how :S.

Edited by -J-

 
n/a ...

Ecstazy



Registered
  04/01/2002
Points
  179

VIP Member
17th December, 2008 at 12:50:32 -

I looked around the Clickteam forums and downloaded this HWA but I'm not sure what it means exactly, can someone elaborate?
Sorry, I've been out of the clicking loop for a while...

 
Amongst Strangers
http://www.create-games.com/project.asp?id=1445

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
17th December, 2008 at 13:12:31 -

Hardware Acceleration: Makes your games run a lot faster, a lot less slowdown and more actives objects etc can be used in games blah blah blah

 
n/a

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  374

VIP MemberCardboard BoxThe Cake is a Lie
17th December, 2008 at 18:00:35 -


Originally Posted by -Nick-
Example:
http://www.nicandreb.f2s.com/2d8games/examples/laserbeam.mfa

It won't be up forever so get it while it's hot. This technique does NOT make MMF a happy bunny unless run in HWA.

Edit 1:
Oh gosh how embarassing! I didnt actually read the last sentance in your post. You can do it without altering the scale, but not without altering the angle. Unless anyone wants to prove me wrong

Edit 2:

What is actually wrong with using the technique i used?



Awesome mfa. Could really help me with something I've been working on. I used and Active object for a mini gun. If (IF) I can figure this out this would totally solve my prob.

Edit: I guess not. What I need is one that isn't a 360, just one that goes to the right.

Edited by W3R3W00F

 
An old and washed up once-kid

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  374

VIP MemberCardboard BoxThe Cake is a Lie
17th December, 2008 at 18:32:53 -


Originally Posted by -Nick-
Example:
http://www.nicandreb.f2s.com/2d8games/examples/laserbeam.mfa

It won't be up forever so get it while it's hot. This technique does NOT make MMF a happy bunny unless run in HWA.

Edit 1:
Oh gosh how embarassing! I didnt actually read the last sentance in your post. You can do it without altering the scale, but not without altering the angle. Unless anyone wants to prove me wrong

Edit 2:

What is actually wrong with using the technique i used?



Awesome mfa. Could really help me with something I've been working on. I used and Active object for a mini gun. If (IF) I can figure this out this would totally solve my prob.

 
An old and washed up once-kid

Ecstazy



Registered
  04/01/2002
Points
  179

VIP Member
17th December, 2008 at 21:36:57 -

Wow, this HWA is really great!
Although it crashes my game at the laser bit if I run it within MMF2, but if I save it as stand alone it's completely smooth.

Thanks a lot!

 
Amongst Strangers
http://www.create-games.com/project.asp?id=1445

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  374

VIP MemberCardboard BoxThe Cake is a Lie
17th December, 2008 at 22:53:46 -

Oops, DP'd. Sorry.

(word...)

 
An old and washed up once-kid
   

Post Reply



 



Advertisement

Worth A Click