Tech Lounge > Programming

Learning Simple E2 with Kräsher!

<< < (4/8) > >>

Frank:

--- Quote from: Kräsher on April 10, 2010, 10:20:13 PM ---I will go over commands later Frank...

--- End quote ---

Foo.

Peetah:
One thing to note. Always try to make your code as clean as possible. Like followingthe basic code structure that applies to all forms of coding. Anyways, my english has really improved :).
Also, Try to make your code as efficiant as possible. this can be measures when you look at the e2 itself and check the ops. (operations per second). this makes the server less laggy and not do as much work. I would have to point somthing out. How come you used interval of 0.5? like interval(20) is more then enough.

Krasher:

--- Quote from: Peetah on April 12, 2010, 05:51:26 PM ---Always try to make your code as clean as possible

--- End quote ---
Example:

--- Code: ---@name Tutorial E2 9
@outputs V:vector
interval(10)
Me=owner()
Prop=entity():isWeldedTo()

if(owner()) {Prop:applyForce(($V*10+V)*Prop:mass()) V=Me:pos()+vec(0,0,150) - Prop:pos()}

if(owner():keyAttack1()) {Prop:applyForce(($V*10+V)*Prop:mass()) V=Me:pos()+(owner():eye()*-100000) - Prop:pos()}

--- End code ---
To:

--- Code: ---@name Tutorial E2 9
@outputs V:vector
interval(10)
Me=owner()
Prop=entity():isWeldedTo()

if(owner()) {
    Prop:applyForce(($V*10+V)*Prop:mass())
    V=Me:pos()+vec(0,0,150) - Prop:pos()
}

if(owner():keyAttack1()) {
    Prop:applyForce(($V*10+V)*Prop:mass())
    V=Me:pos()+(owner():eye()*-100000) - Prop:pos()
}

--- End code ---

Frank:
Cool E2, bro.

Peetah:

--- Quote from: Kräsher on April 12, 2010, 07:04:01 PM ---Example:

--- Code: ---@name Tutorial E2 9
@outputs V:vector
interval(10)
Me=owner()
Prop=entity():isWeldedTo()

if(owner()) {Prop:applyForce(($V*10+V)*Prop:mass()) V=Me:pos()+vec(0,0,150) - Prop:pos()}

if(owner():keyAttack1()) {Prop:applyForce(($V*10+V)*Prop:mass()) V=Me:pos()+(owner():eye()*-100000) - Prop:pos()}

--- End code ---
To:

--- Code: ---@name Tutorial E2 9
@outputs V:vector
interval(10)
Me=owner()
Prop=entity():isWeldedTo()

if(owner()) {
    Prop:applyForce(($V*10+V)*Prop:mass())
    V=Me:pos()+vec(0,0,150) - Prop:pos()
}

if(owner():keyAttack1()) {
    Prop:applyForce(($V*10+V)*Prop:mass())
    V=Me:pos()+(owner():eye()*-100000) - Prop:pos()
}

--- End code ---

--- End quote ---

Very good Krasher. Just like how a real profetional coder would do it. I do respect you Krasher. Very wise for your age. Just dont get carried away with this power.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version