StanBond's Recent Forum Activity

  • Hello,

    I have a family named fakefam, it is a list of items, according to my event whenever I click on the fakefam items, it spawns an object (red) behind it.

    Now I want it to destroy the object behind the corresponding item from fakefam whenever I click on fakefam item again.

  • The problem is the code runs top to bottom. You set cart to 1, then it proceeds to the next line and it reads cart =1. You need to use "Else".

    System > Cart = 1 > Set Cart to 1

    Else > ____________> Set Cart to 0

    Thank you, else statement worked for me

  • This is really simple task but I've faced some dead end.

    It's just not working. I've tried to do the same with variables,

    if cat1 = 0, make visible and set cat1 value to 1,

    if cat1 = 1, make invisible and set cat 1 value to 0.

    But it would always show 0, as if it reads from top to down, and from some reason read separate event right away.

  • More or less I've managed to do this, for testing I've manually inserted the saved data into variable.

    The issue I can't overcome is that in order to maintain whole numbers I had to use round, the problem now that values of less than 0 now are being rounded to 1 and as you can see it will add 1 to stamina, so in other words if user will keep on refreshing the page stamina will grow by 1 each time.

  • Use more sprites. The more detailed motion it is the more realistic it will be

  • Thanks for the suggestions however I've faced some awkward issue.

    I've prepared an illustration for the better understanding of the problem.

    When ever I press the attack button on the bottom left, it deducts from stamina 2 points, then there should be a timer that starts counting 2 minutes after which there will be refilled one point and make it 99/100.

    This is where the issue occurs, whenever I try to take the current time using the Browser, I take the time when this action was made, add to it the 2 minutes in milliseconds, and perform another event check if this value is < than the current time, then there should be an increase of stamina by 1.

    Following this method, if i'll have for example 67/100 points, i won't be able to see 68/100, 69/100, ..., n/100 it will simply jump to 100/100 once the total time has passed. Moreover, considering this in cases when the user logs out, and returns, some time has passed so he must have the corresponding filled points.

    The issue in two words, how to make it add 1 point every X seconds even when the user is offline. The solution i have in mind is making an array with the time stamps for each point. Which is a very strange and awkward attempt to resolve this task.

  • Thanks but I've kind of gave up on this idea for now, as i'm a beginner in php so i've decided to store my whole json in one column.

  • Lets say I have Stamina bar, whenever I press Attack button, it subducts the stamina variable by 1. The refill of stamina being performed by 1 every 2 minutes.

    What must be done to make it refill even when the user off-line?

  • Then, I guess, you should add another parameter to the php and to c2

    Example: if you add a parameter $string to php, make Data in c2 to: "L=" & UserLogin & "&S=" & UserPass & "&string=" & savestats.Text

    Thanks a lot! That kept me occupied for several hours.

    Here is how I solved it:

    Undefined index: has been resolved using isset:

    if(isset($_POST['L'])){
        $Login = $_POST['L'];
    
    }else {
        $Login = null;
    
    }
    
    if(isset($_POST['S'])){
        $PW = $_POST['S'];
    
    }else {
        $PW = null;
    
    }
    
    if(isset($_POST['D'])){
        $datum = $_POST['D'];
    
    }else {
        $datum = null;
    
    }
    [/code:1s003siu]
    
    and at construct 2 post I've used the following path on the basis of your suggestion:
    [code:1s003siu]"L=" & UserLogin & "&S=" & UserPass & "&D=" & savestats.Text[/code:1s003siu]
    
    Working like a charm!
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It seems like what you're trying to do is sending data twice (two datas – first in URL field and another time in Data field).

    Try to do like this:

    URL: "http://localhost/legacy/save.php"

    Data: "L=" & UserLogin & "&S=" & UserPass"

    I'm not sure what's the savestats.Text inside the Data field.

    Thanks for reply, savestats.Text contains json string that must be inserted into the database.

    In other words, the place with $datum, must be provided with the string from savestats.Text

  • Hello, I've managed to make the Get with ajax to work, now i'm trying to Post some data and I'm getting errors.

    Here is how my php file looks like:

    header("Access-Control-Allow-Origin: *");
    
    $user = "root";
    $pass = "";
    
    $dbh = new PDO('mysql:host=localhost;dbname=dbname', $user, $pass);
    
    $Login = $_POST['L'];
    $PW = $_POST['S'];
    $datum = '{"c2array":true,"size":[3,10,1],"data":[[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[["Fatso"],[1000],[100],[900],[10],[10],[39],[10],[10],[0]],[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]]}';
    
    $sql = $dbh->query("UPDATE registration SET data = '$datum' WHERE uemail = '$Login' AND upassword = '$PW'");[/code:dpqxiom2]
    
    Here is my construct 2 post request:
    [img="http://s33.postimg.org/7txzoq9gv/image.png"]
    
    At the debugger i'm getting:
    [code:dpqxiom2]Undefined index: L[/code:dpqxiom2]
  • Thanks for the reply! I did that because if the burger isn't overlapping them, I want the burger to return to its starting position. However if it is overlapping them, then I want the burger to snap to them. Any ideas?

    Add all of the water containers to one family, then do the water containers overlaping the burger, set position to the water containers X and Y. And do the same with invert activated, in this case set position will be the initial burger position.

StanBond's avatar

StanBond

Member since 11 May, 2016

None one is following StanBond yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies