The Daily Click ::. Forums ::. Klik Coding Help ::. Railgun problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Penguin Seph



Registered
  11/12/2002
Points
  1338
11th March, 2004 at 12:44:10 -

Hi! I have a problem in this game I am making with Fenner. I want a Railgun weapon in ths game and I can't get it to work. I tried using Fastloop. Can anyone help?

 
Hi!

Pkeod

Oontz Oontz Oontz

Registered
  19/11/2002
Points
  93

VIP Member
11th March, 2004 at 16:20:53 -

So uh... whats the problem? Explain.

 
Faerie Solitaire - Get it now:

http://www.create-games.com/download.asp?id=7792

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
11th March, 2004 at 21:15:35 -

You could just have a really long, skinny active object since Railguns score instant hits.

 
XBL Gamertag: Rampant Mjolnir

Kramy



Registered
  08/06/2002
Points
  1888
11th March, 2004 at 23:33:21 -

Make sure your fastloops are at the top of the conditions, or they won't work.

Fastloops are ran in order from top to bottom in the event list, but the event list only continues going down after the loop is complete.

 
Kramy

Nuutti



Registered
  26/10/2003
Points
  1364
12th March, 2004 at 03:23:39 -

can you explain what is a railgun i dont know

 
P.S. sorry for my mangled english.

jast



Registered
  03/01/2014 01:12:19
Points
  186
12th March, 2004 at 04:30:15 -

@Kramy: That's wrong. Loops work wherever you put them. My whole current project is filled with loops (using both, the fast loop object and MMF's internal loops) and I've never had any problems with placing them even at the very bottom of all my events.

 
n/a

cake



Registered
  13/12/2002
Points
  1173
12th March, 2004 at 09:09:11 -

[A quick note on fastloop: um I cant exactly remember for sure, but I'm pretty sure the action "Start loop 'x'" actually jumps out of the action list to the loop event, executes that event the number of times u specify, then jumps back to the action that called the loop in the action list. Just like any sub-routine/function/sub-program call in programming languages. Tigerworks wrote a very good article all about this i dont remember where it is tho]

Ok, here's a kind of system you could use:

Objects needed:

Active Objects:
• Player - no doubt you already have this
• Painter - not visible at start, do NOT destroy if too far from frame, do NOT deactivate if too far from frame, do NOT follow the frame
• RailParticle - small, 2x2px or whatever. this will make up the beam, in terms of Quake II, this is grey
• SwirlParticle - similar to the above, this will be the little swirly kind of stuff that filters off from the beam, in terms of Quake II, this is blue

Other Objects:
• Fast Loop Object - Only if you aren't using MMF
• Advanced Direction Object (ADO) - Only if you want to do directional aiming, like, with the mouse

Events:

1.
Always
+ Flag 0 of [Painter] is OFF:

• Set direction of [Painter] to ADO→Get Direction(X of [Player], Y of [Player], XMouse, YMouse) /*If you dont want to use mouse aiming, just substitute "Direction of [Player]" here instead*/

2.
Player 1 pressed fire button 1:
• Set position of [Painter] to (0,0) from [Player]
• Set flag 0 of [Painter] ON
• Start loop "MakeBeam" for 400 loops /*Number of loops determines range of the weapon*/

3.
On loop "MakeBeam"
+ NOT [Painter] is overlapping backdrop
+ X of [Painter] < X Right Frame
+ X of [Painter] > X Left Frame
+ Y of [Painter] < Y Bottom Frame
+ Y of [Painter] > Y Top Frame:

• Set X position of [Painter] to [X position of Painter]+ADO→GetXMovement(Direction of [Painter], 3)
• Set Y position of [Painter] to [Y position of Painter]+ADO→GetYMovement(Direction of [Painter], 3) /*the value of "3" determines the space between the beam particles, the smaller, the better the beam will look, but the more objects it will need and the more loops you will need to make a long beam, thus its pretty chunky*/
• Create [RailParticle] at (0,0) from [Painter]

4.
On loop "MakeBeam"
+ [Painter] is overlapping backdrop:

• Stop loop "MakeBeam"
• Set flag 0 of [Painter] OFF

5.
On loop "MakeBeam"
+ X of [Painter] < X Left Frame

• Stop loop "MakeBeam"
• Set flag 0 of [Painter] OFF

6.
On loop "MakeBeam"
+ Y of [Painter] > Y Bottom Frame

• Stop loop "MakeBeam"
• Set flag 0 of [Painter] OFF

7.
On loop "MakeBeam"
+ Y of [Painter] < Y Top Frame

• Stop loop "MakeBeam"
• Set flag 0 of [Painter] OFF

8.
Every 0.04 seconds
+ Number of [RailParticle] > 0:

• Shoot [SwirlParticle] from [RailParticle] in random direction out of 32 at speed 15

9.
Number of [RailParticle] > 0:
• Add 1 to value A of [SwirlParticle]
• Add 1 to value A of [RailParticle]
• Set semi transparency of [SwirlParticle] to (Value A of [SwirlParticle] * 10)
• Set semi transparency of [RailParticle] to (Value A of [RailParticle] * 5)

10.
Semi Transparency of [SwirlParticle] > 100:
• Destroy [SwirlParticle]

11.
Semi Transparency of [RailParticle] > 100:
• Destroy [RailParticle]

12.
<enemy> is overlapping [RailParticle]
+ Value A of [RailParticle] <= 7:

• <kill/damage enemy>

end of document

That should just about cover it, it's pretty late here I might of missed something. Of course the effects are pretty basic, a LOT more could be done to make it look way cooler, I might write an article sometime with more effects and such. Hope that helps, if there's any problems contact me on MSN at: biax666@hotmail.com

Image Edited by the Author.

 
n/a

X_Sheep

I had a custom rating before it was cool

Registered
  01/03/2004
Points
  1313

VIP MemberPicture Me This -Round 23- Winner!Dos Rules!
12th March, 2004 at 09:48:09 -

"You could just have a really long, skinny active object since Railguns score instant hits."
I don't think that would work. If you did that then you could hit multiple enemies, even behind walls

 
a/n

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
12th March, 2004 at 11:14:15 -

Oh yeah... good point. The fastlooping example posted by Biax is definitly the way to go.

 
XBL Gamertag: Rampant Mjolnir

Penguin Seph



Registered
  11/12/2002
Points
  1338
12th March, 2004 at 12:03:11 -

Whoo! Now to code that!

 
Hi!

Kramy



Registered
  08/06/2002
Points
  1888
12th March, 2004 at 13:41:33 -

Jannis: Read a post thoroughly before you say it's wrong. Here's what I wrote, expanded.

Make sure your fastloops are at the top of the conditions, or they won't work.

Example:
-----Fastloop is at top of condition-----
On loop "LoopName"
+ Some other condition
+ Some other condition
-- Do something

Fastloops are ran in order from top to bottom in the event list

Example:
-----Fastloop is called in an event-----
Event list is checked from top to bottom for loop events, and they are ran. Loopstep goes down one, and starts again if it isn't 0.

but the event list only continues going down after the loop is complete

Example:
-----Fastloop is over and reached 0-----
The event list continues processing from where the loop was originally called.



 
Kramy
   

Post Reply



 



Advertisement

Worth A Click