Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
05-01-2012, 11:22 AM |
|
Homicide13
Senior Member
Posts: 323
Threads: 41
Joined: Nov 2010
Reputation:
14
|
RE: [CHALLENGE THREAD]
Alright, that's what I thought, but I just wanted to make sure. ;_;
|
|
05-01-2012, 12:37 PM |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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).
|
|
05-01-2012, 02:07 PM |
|
Apjjm
Is easy to say
Posts: 496
Threads: 18
Joined: Apr 2011
Reputation:
52
|
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 |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
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 |
|
Homicide13
Senior Member
Posts: 323
Threads: 41
Joined: Nov 2010
Reputation:
14
|
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 |
|
Apjjm
Is easy to say
Posts: 496
Threads: 18
Joined: Apr 2011
Reputation:
52
|
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 |
|
Homicide13
Senior Member
Posts: 323
Threads: 41
Joined: Nov 2010
Reputation:
14
|
RE: [CHALLENGE THREAD]
So what is the new challenge?
|
|
05-02-2012, 05:45 AM |
|
Theforgot3n1
Member
Posts: 192
Threads: 20
Joined: Apr 2012
Reputation:
6
|
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.
Or ah, don't mind me.
|
|
05-02-2012, 09:19 PM |
|
|