Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 14 Vote(s) - 2.93 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge Threadᆦ ᆦ ᆦ
Author Message
Your Computer Offline
SCAN ME!

Posts: 3,475
Joined: Jul 2011
Reputation: 235
Post: #171
RE: [CHALLENGE THREAD]

(05-01-2012 05:20 AM)Homicide13 Wrote:  Hm Wait a second, why are you using the "->" to reference the class' member functions?

Most likely a C++ habit he unconsciously let through.

Tutorials: From Noob to Pro
05-01-2012 11:22 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Homicide13 Offline
Senior Member

Posts: 323
Joined: Nov 2010
Reputation: 14
Post: #172
RE: [CHALLENGE THREAD]

Alright, that's what I thought, but I just wanted to make sure. ;_;

05-01-2012 12:37 PM
Find all posts by this user Quote this message in a reply
nemesis567 Offline
Posting Freak

Posts: 881
Joined: May 2011
Reputation: 10
Post: #173
RE: [CHALLENGE THREAD]

Huh? Maybe. I thought, array, pointer, pointer requires ->.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
05-01-2012 01:35 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,475
Joined: Jul 2011
Reputation: 235
Post: #174
RE: [CHALLENGE THREAD]

(05-01-2012 01:35 PM)nemesis567 Wrote:  Huh? Maybe. I thought, array, pointer, pointer requires ->.

You're confusing yourself with something else. Then again, even in C++ arrays or classes aren't always allocated with the new keyword (though, only classes can have methods).

Tutorials: From Noob to Pro
05-01-2012 02:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Apjjm Offline
Super Moderator

Posts: 482
Joined: Apr 2011
Reputation: 49
Post: #175
RE: [CHALLENGE THREAD]

My solution:
void OnStart()
{
    //Attach some prop detectors to the bridges
    AddAttachedPropToProp("bridge_1","collider_1","bridgeCollider.ent",0,0,0,0,0,0);
    AddAttachedPropToProp("bridge_2","collider_2","bridgeCollider.ent",0,0,0,0,0,0);
    
    //Callbacks
    AddEntityCollideCallback("barrel01_*","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("Player","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("barrel01_*","collider_2","cbAddPropBridgeUp",false,0);
    AddEntityCollideCallback("Player","collider_2","cbAddPropBridgeUp",false,0);
    
}


//Add/Remove a prop to the bridge we need to pull down
void cbAddPropBridgeDown(string &in asParent, string &in asChild, int alState)
{    
    if(asParent == "Player")
        AddLocalVarInt("BridgeDown",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeDown",alState);
    moveBridges();
}

//Add/Remove a prop to the bridge we need to pull up
void cbAddPropBridgeUp(string &in asParent, string &in asChild, int alState)
{
    
    if(asParent == "Player")
        AddLocalVarInt("BridgeUp",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeUp",alState);
    moveBridges();
}

//Determine what levels the bridges should move to
void moveBridges()
{
    //Relative weights on bridges
    int up   = GetLocalVarInt("BridgeUp");
    int down = GetLocalVarInt("BridgeDown");
    int diff = up - down;
    AddDebugMessage("Up: " + up + " Down: " + down + " Diff: " + diff,false);
    
    //Work out relative weights & clamp (to stop bridges going through the floor).
    float state = diff * 0.1f;
    if(state>1.0f)       state = 1.0f;
    else if(state<-0.5f) state = -0.5;
    
    //Move based on relative weights
    SetMoveObjectStateExt("bridge_1",-state,0.65f,1.5f,0.125f,true);
    SetMoveObjectStateExt("bridge_2",state,0.65f,1.5f,0.125f,true);
}
I used the Bridge Collider entity which i provided as an addition file.

05-01-2012 03:47 PM
Find all posts by this user Quote this message in a reply
nemesis567 Offline
Posting Freak

Posts: 881
Joined: May 2011
Reputation: 10
Post: #176
RE: [CHALLENGE THREAD]

quite simpler than mine.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
05-01-2012 04:04 PM
Find all posts by this user Quote this message in a reply
Homicide13 Offline
Senior Member

Posts: 323
Joined: Nov 2010
Reputation: 14
Post: #177
RE: [CHALLENGE THREAD]

Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?

05-01-2012 06:01 PM
Find all posts by this user Quote this message in a reply
Apjjm Offline
Super Moderator

Posts: 482
Joined: Apr 2011
Reputation: 49
Post: #178
RE: [CHALLENGE THREAD]

(05-01-2012 06:01 PM)Homicide13 Wrote:  Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?
Not always, but you are free to make that interpretation. The behaviour depends on the mechanics "behind the scenes" of the balancing on the bridges (Obviously if it is just bridge->pulley->pulley->bridge then yes). The specification I gave wanted a counterbalance puzzle, I am not too concerned how people interpreted that (and how the bridges should behave - assuming it isn't totally unintuitive) past the point of putting boxes onto bridge 1 effects bridge 2 in a proportional and opposite manner - so either is/was acceptable.

(This post was last modified: 05-01-2012 06:47 PM by Apjjm.)
05-01-2012 06:39 PM
Find all posts by this user Quote this message in a reply
Homicide13 Offline
Senior Member

Posts: 323
Joined: Nov 2010
Reputation: 14
Post: #179
RE: [CHALLENGE THREAD]

So what is the new challenge? Smile

05-02-2012 05:45 AM
Find all posts by this user Quote this message in a reply
Theforgot3n1 Offline
Member

Posts: 192
Joined: Apr 2012
Reputation: 6
Post: #180
RE: [CHALLENGE THREAD]

First i was like: Yeah, there will be some guy solving everything instantly anyway. But I just noticed that you are answering most of the challenges. Which means that people don't know how to answer these.
If you could make the challenges slightly easier, maybe I can actually participate. Big Grin

Or ah, don't mind me.

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
05-02-2012 09:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)