StanBond's Forum Posts

  • I have a flashlight underneath it I have placed a sprite to simulate the light beam (triangle sprite with reduced opacity of yellow color).

    The problem is, if I copy my flashlight without cloning/creating new object, how can I make it have this light beam also?

    For example, If i'll add drag and drop on my flashlight, whenever I move my flashlight its light cone must move with it.

    I hope this will illustrate it

    At the moment the only option I see is using frames, one without the lightbeam and one with, and switch between them.

  • ..glad to hear..

    > I've managed according to the tutorials to use the local json file through the files folder. Now I would like to try out hosted version of it.I've tried to use the AJAX request http://www.site.com/file.json, but nothing worked...

    >

    so..let's say.. you upload json file on your site

    http://www.StanBond.com/gamefolder/file.json[/code:6tp5f9fw]
    and than you use
    [img="http://lookpic.com/O/i2/997/i48LnMDP.png"]
    in [b]Preview[/b](on localhost) this request will most likely fail & in [url=https://developer.chrome.com/devtools#console]console[/url] you will see something like 
    [img="http://lookpic.com/O/i2/100/UXShPyYF.png"]
    you can bypass this ...with small PHP file(file.php)
    [code:6tp5f9fw]<?php
    header('Access-Control-Allow-Origin: *');
    $myfile = file_get_contents('http://www.StanBond.com/gamefolder/file.json');
    echo $myfile;
     exit;
    ?>[/code:6tp5f9fw]
    upload this in your [i]gamefolder[/i] 
    [code:6tp5f9fw]http://www.StanBond.com/gamefolder/file.php[/code:6tp5f9fw]
    and now  you  request
    [img="http://lookpic.com/O/i2/298/JDWRFZoK.png"]
    
    I really don't know if this is a good way....but works..
    

    I was also worried about the usability of this approach, and as in the most cases there is a need to read generated by the server json, I've decided to assign the json string onto the variable and echo it.

    <?php
    
    header('Access-Control-Allow-Origin: *');
    header('Content-Type: application/json');
    
    $string = '{"c2array":true,"size":[3,10,1],"data":[[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[["Nameless"],[1000],[100],[100],[10],[10],[50],[10],[10],[0]],[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]]}';
    
    echo ($string);
    ?>
    [/code:6tp5f9fw]
  • like this?

    Thanks I'll look into this one too

  • I've done something similar

  • I assume this is what you've been suggesting:

    Only the first time is doing it the right way, after that it starts to twitch for 1/2 degrees every secound or so.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    I was trying to build something simple. Camera that moves within the defined angle range. Lets say, I have a camera and I want it to look through the area of 40 degrees, so it will move from 0 degrees to 40 degress wait 1 second and go back to 0 degress and then repeat this process endless times.

    Here is what I've done, I've made a system repeat that every 3 seconds Sprite 1 will set its angle to 20 degrees wait 1 second and then set angle to 0 degrees.

    The issues is that it's not rotating at all, it just jumps between the states from 20 to 0 degrees and I want the came to rotate slowely.

    How can this be done?

  • Thanks that worked!

  • Hello, I've managed according to the tutorials to use the local json file through the files folder. Now I would like to tryout hosted version of it.

    I've tried to use the AJAX request , but nothing worked, then I've tried to setup a php file index.php with the following contents

    <?php
    
    echo date ("h:i:s");
    
    ?>[/code:3o6rnsop]
    
    Just to try and output it, but nothing working so far.
    
    What am I doing wrong?
  • When you press the button, check if the apple overlaps the cup. No variable needed.

    I would do this but, I was looking for a solution that will allow me to have multiple cups.

    For example, I have 3 cups - 2 of them red, and I have two apples, the apples must be placed on red cups only.

    So at the end the user got the button to check if he placed them all correctly.

  • Do you really need the variable then? The "Overlapping" condition is giving you the data you need.

    I have a button, which later on when I press got to check if the apple is on the cup

    >

    > Something similar can be done with overlapping, but when I set current value of variable+1, it just goes razor fast up without limiting to the increment of 1.

    >

    >

    This is because it adds 1 every tick/frame while the apple is on the cup. I do not know if you just want it to be 1 for on cup, 0 if not on cup or if you want 1 to be subtracted/added every second. In the case of the latter, change add/subtract "1" to "1*dt", that will add one per second regardless of framerate.

    You have three options if you just want 1 or 0 for on cup:

    1) Instead of add to/subtract from variable use "set value" action.

    2) Add a "trigger once while true" condition to the overlap event.

    3) Don't use a global variable, add a boolean variable to the apple object called OnCup and set it to true/false if it is overlapping/not overlapping.

    Thanks I'll try this out

  • I have a cup and apple, when I place my apple on my cup I want the variable "onCup" to increase by 1, and when I remove it from the cup I want it to decrease by 1.

    As I see it, there should be some listener that will listen to the condition, while its on the cup increase by 1, if its no longer on the cup then decrease by 1.

    Didn't find any tutorial that explains this approach.

    Something similar can be done with overlapping, but when I set current value of variable+1, it just goes razor fast up without limiting to the increment of 1.

    Looking forward to your help.

  • So I have made an inventory slot, and the idea is of the following:

    Got only one inventory slot with 10 apples stacked in it, something like an apple and at the bottom left corner it says how much apples i got in this slot right now, whenever I displace the apple with drag and drop function beyond the inventory slot it should reduce the current number of apples in the slot.

    The problem, I've created 10 instances of apples, created global variable with value 10 and made it the way that whenever i move an apple beyond the slot it will subtract 1 from the global variable. However as it stands now i had to use "Is overlaping" for the apple that overlaps the inventory slot, whenever I take the apple away it keeps subtracting. What I want is to reduce the global variable by one whenever the apple leaves the inventory slot.

    Any suggestions? By the way, maybe someone can suggest any method to take care of these apples in more comfortable manner, as in case of 100 apples will be hard to manage them all.

    Thanks!

  • Thanks 99Instances2Go, works like a charm, the invert suggestion regarding "on collision" kept me really busy as it was greyed out

  • Hello,

    So I have made a button, sprite with a flower (attached drag and drop to it), whenever I move my flower on to the button I've made a collision detection the way it will turn on the particle by changing its position from the outside of the screen to the position of the button, and everything works great. But now I want my particles to go away why I move away the flower from my button. How do I detect that there is no longer a collision?

    Thankds!