Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 5 Vote(s) - 4.2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Amnesia: The Second Dimension [READY FOR LAUNCH]
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#61
RE: Amnesia: The Second Dimension [SERIOUSLY?!?!]

Daemian Wrote:Hey, wait, I found another way to loop a function without timers!
This seems to be looping once every 0.01 seconds. (100 times per second)
Is that an acceptable number for your game Behe? Or you need it to loop faster?

I'm editing in a second with the code in case you wanna give it a try.

Basically it's an entity jumping from one area to another.
The areas fire a collide callback, throwing the object from area A to area B in a constant loop.

This process -according to tests- takes about to one unit of a second. (I can see the debug messages increasing by 100 every second). So it's fast, and kinda light to process too.

So, two areas and one entity.
You declare the entity callback on both areas, and use PlaceEntityAtEntity to send the object to the other area.

That will loop, and you can use the function to run your things.

Here's the code:

PHP Code: (Select All)
void OnStart ()
{

    
AddEntityCollideCallback"Area1""EntityX""LoopFunction"true);
    
AddEntityCollideCallback"Area2""EntityX""LoopFunction"true);



PHP Code: (Select All)
void LoopFunction string &in sAreastring &in sEntityint iState )
{

    if ( 
sArea == "Area1" ) { 
        
AddEntityCollideCallback"Area2"sEntity"LoopFunction"true);
        
PlaceEntityAtEntitysEntity"Area2", EMPTY, true ); 
        
        }
    if ( 
sArea == "Area2" ) { 
        
AddEntityCollideCallback"Area1"sEntity"LoopFunction"true);
        
PlaceEntityAtEntitysEntity"Area1", EMPTY, true ); 
        
        }
    
         
//UpdateGruntsAnimation();
         //UpdateOtherThing();
         //UpdateJumpingStuff();



You gotta hide these two areas and entity in your maps, somewhere safe from the action.
What else? I attached the entity I'm using, it has no gravity, no collision, nothing. Just what it needs to make this work.
Mmmmh Am I missing something? Anyways, there it is, I hope you like it.


Attached Files
.zip   TimerObjectX.zip (Size: 1.38 KB / Downloads: 92)

(This post was last modified: 02-22-2015, 08:09 PM by Daemian.)
02-22-2015, 08:06 PM
Find


Messages In This Thread
RE: Amnesia: The Second Dimension - by Romulator - 09-07-2014, 03:01 AM
RE: Amnesia: The Second Dimension - by Mudbill - 09-07-2014, 03:13 AM
RE: Amnesia: The Second Dimension - by MrBehemoth - 09-07-2014, 12:42 PM
RE: Amnesia: The Second Dimension - by Streetboat - 09-07-2014, 05:56 AM
RE: Amnesia: The Second Dimension - by Slanderous - 09-07-2014, 11:36 AM
RE: Amnesia: The Second Dimension - by Rapture - 09-07-2014, 08:29 PM
RE: Amnesia: The Second Dimension - by MrBehemoth - 09-07-2014, 08:47 PM
RE: Amnesia: The Second Dimension - by Neelke - 09-07-2014, 08:42 PM
RE: Amnesia: The Second Dimension - by AGP - 09-07-2014, 09:11 PM
RE: Amnesia: The Second Dimension - by MrBehemoth - 09-08-2014, 06:18 PM
RE: Amnesia: The Second Dimension - by MrBehemoth - 09-27-2014, 01:10 AM
RE: Amnesia: The Second Dimension - by Viper85626 - 09-27-2014, 01:38 AM
RE: Amnesia: The Second Dimension - by MrBehemoth - 11-01-2014, 04:21 PM
RE: Amnesia: The Second Dimension [SERIOUSLY?!?!] - by Daemian - 02-22-2015, 08:06 PM



Users browsing this thread: 2 Guest(s)