tmntppn's Forum Posts

  • Well to make it, you need to think about it.

    Specify your problem please.

    https://www.scirra.com/forum/tips-for-posting-in-the-quot-how-do-i-quot-forum_t62843

  • When I use the arrow to move..when it couches the grey border..it seems to go out a little then jumps back in..

    LOL... I did it on purpose as I thought it was fun and smother... <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes">

    There are many ways you can adjust it. Just look at the big picture about how to detect your trigger (arrow keys) and validate the value before you make the move.

    Try this: https://www.dropbox.com/s/s68pe4hib7r18 ... .capx?dl=1 (this one isn't using the 8Direction behavior)

    I'm not sure what you intend to do with this, if you're going to make multiple objects and obstacle that aren't penetrable anyway, then adding wall objects and solid behavior will be much easier to do: https://www.dropbox.com/s/gmxpetto7mfsa ... .capx?dl=1

  • This is the closest I can get: https://www.dropbox.com/s/tetva39um81sj ... .capx?dl=1

    Enter the amount in the textbox. The error starting at n = 5, where the rounding (floor) will cause the difference.

  • Try this: https://www.dropbox.com/s/hor58fh29csb8 ... .capx?dl=1

    You can drag the green object with mouse or use arrow keys.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • As chrisinfinger said, one weakness about overlapping condition is that it only measure "at least" overlapping. This means that you can have the object overlapping by a single pixel, while the rest is out of the square, and still considered overlapping. This depends on how you want it in your project.

    For example my project, I have a feature where the user can arrange a table layout in a room. This of course, cannot have a single pixel out of the square as the table would puncture the wall. In my case, I cannot use overlapping condition.

    I prefer with some comparison, as I don't want to add unnecessary object. Here's what I do (very simple actually):

    if (Table.BBoxLeft >= FloorObj.BBoxLeft AND
    Table.BBoxRight <= FloorObj.BBoxRight AND
    Table.BBoxTop >= FloorObj.BBoxTop AND
    Table.BBoxBottom <= FloorObj.BBoxBottom) {
    	[VALID LOCATION]
    	Table set animation frame to 0
    }
    else {
    	[INVALID LOCATION]
    	Table set animation frame to 1
    }
    [/code:3co0tcxe]
  • There are a couple of calculations and draw calls which need to be run sequentially. It use either wait for signal or wait 0 second (next tick) before running. Let's say it is possible to run things without waiting at all, but this will require whole lots of sub-events and it's going to be hard to manage (calling sub functions etc). Any suggestion to workaround this?

    Another thing that I want is to make a function, for example, to request a user input a pin number, then return the result 1/0 (success/failed) to the caller. Surely waiting for user input require a lot of ticks. Can this be done?

  • Thank you for your suggestion but the problem is not on the AJAX. I use AJAX a lot too and all already using its own on 'tag' completed. I never use AJAX on any completed. I've also been using a lot of signaling, so far so good.

    I've boiled down my problem and I think the problem is because the return value is only available after some ticks, so the caller already "expired", thus the return value is not returned to the right caller. So this probably is because of my method, not what I originally thought that return value applies to all functions globally.

    I run some test with 2 methods, a main body which call for 2 functions, and the function A and B itself, each wait for 1 second before returning the value (simulating this function requires some ticks to complete). Here's what I tried:

    -----FUNCTION A (NOT WORKING)-----
    function run_A {
    	wait 1.0 second
    	set return value to "result of A"
    }
    
    -----FUNCTION B (WORKING)-----
    function run_B {
    	set return value to "result of B"
    }
    
    void main() {
    	on button clicked {
    		set var A to Function.Call("run_A");
    		set var B to Function.Call("run_B");
    	}
    }
    [/code:33fw5n67]
    
    Result:
    [code:33fw5n67]A = 0
    B = "result of B"[/code:33fw5n67]
    
    I'm guessing that on my project, because both functions takes some ticks to complete, the return value isn't received by the caller. So my question is, how can I return a value that is not available at an instant or should I use other method than return value (static var and signaling perhaps)?
  • How about storing all related object's UID in an array, sort them, then pick one by one and set it to top?

    Probably 2 dimensional array, y(0) = Y coordinate; y(1) = object type ("sprite"/"tilemap"); y(2): UID. This way, you can sort by X axis and get the sort by Y coordinate.

    first store each UID in array;
    sort array by X axis;
    for each array x element {
    	if( array.at(array.curX, 1) == "SPRITE") {
    		pick [sprite object] with UID = array.at(array.curX, 2);
    		move object to top of layer;
    	} else {
    		pick [tilemap object] with UID = array.at(array.curX, 2);
    		move object to top of layer;
    	}
    }[/code:zpdjcf18]
  • The var value and pin is a sort of global object (in json form). Generally speaking, I'm trying to avoid setting the value directly within the function as this will makes it harder for me to manage the modules (I've use that method before but now I'm trying to do it more object oriented).

  • I had done this before, but with sprites only (I didn't use tilemap on my project at that time).

    You can do like this:

    for each [object] order by [object].Y descending {
    	[object] move to top of layer
    }[/code:gmbonft5]
  • I have a project with quite a lot of multitasking inside, with each task might call for specific function, or 2 tasks call for 1 function with different parameter(s), either manually called or automatically scheduled.

    From what I have experienced, return value applies globally, meaning that whichever condition at the same tick request a return value, all will read the same value returned.

    On my project, I have a "synchronize" group that call for a sync function at every set duration. The sync will send an AJAX request to a remote server so the syncing process took several ticks to complete (~10 ticks). At the same time, I have a "user interface" group that will call for a function whenever a user calls them (~5 ticks).

    Short illustration of the sync group:

    every 300 tick {
    	value = get_sync();
    	[some actions...]
    	end
    }
    get_sync() {
    	var x;
    	[some actions...]
    	set return value to x;
    }
    [/code:30024806]
    Short illustration of the UI group:
    [code:30024806]if ( button_a pressed ) {
    	pin = get_auth(user_a);
    	[some actions...]
    	end
    }
    get_auth(var user) {
    	var y;
    	[some actions...]
    	set return value to y;
    }
    [/code:30024806]
    The problem will occur if:
    [code:30024806]
    @ 1670 tick: get_sync (supposed to end at 1680)
    @ 1675: get_auth()
    @ 1680: value = pin = [returned value from one of the function above]
    [/code:30024806]
    Is there a way to differentiate a return value, to identify which function calls for it? Maybe like Function.ReturnValue("my_function")?
  • Ah okay, I get it now. Thanks.

  • tmntppn

    I guess that you might run the older version of firebase, which does not have api key. i.e. api key is necessary in current version (v3).

    I already use firebase_apiV3, but I usually just set the database URL and leave the rest blank.

  • tmntppn

    Do you put rex_firebase_apiV3 plugin into project? sample capx

    Yes, I did. The "basic" firebase plugin works just fine. The sample above works, but others from that OneDrive page (such as "itemtable v3 - foreach item, foreach key.capx") doesn't work.

    EDIT: It turns out the itemtable doesn't work because I didn't set the API key. After I set the key, it works. However, without the key, the basic firebase plugins works (that's why I didn't suspect it before seeing your sample above). What does this API key for?

  • rexrainbow

    Hi rex, I'm just starting to try your itemtable plugins, but don't quite understand how to begin with. I've tried some of your samples but got this error instead:

    Javascript error!
    Uncaught Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp().http://localhost:50000/firebase.js, line 26 (col 293)[/code:35ztt4sm]
    What am I doing wrong?