AllanR's Forum Posts

  • ChesVCF - have you looked at the "Audio Analyser" sample on the Advanced Examples tab of Construct3?

  • I was able to download the plugin and the example file a few minutes ago from the links in the first post of the thread. and it works just fine.

    the example doesn't even have the Local Storage plugin in it, so that is not how you use it. The TimeAwayL plugin directly accesses local storage for you. you also don't want to pause the timer while your program is running and then try to start it manually when the program suspends or is closed down. Just use "Get or Start timer" at the start of the layout and just leave it run forever.

    the "timer" is just a time stamp. Nothing actually happens until you check the elapsed time (it just calculates the difference between the initial time stamp and now).

    Construct2 can't do push notifications, but I think there are plugins and 3rd party services that can do that.

  • Gadgetkk

    you could also use Bullet behavior (set the speed fairly low and gravity high) or physics...

  • Lernox

    Construct can't tell the difference between the left and right shift/ctrl keys, so you have to use javascript to add an even listener (and this might not work the same on all browsers). You can have javascript call a Construct function, passing in which one was pressed.

    It gets tricky when you want to hold down the shift keys, because then you also have to watch for keyup events as well as the keydown event.

    on my keyboard, Chrome and Firefox seem to have a bug when you press both shift keys at the same time. Only one of the keyup events fires. This doesn't happen for the CTRL keys, and it doesn't happen in Edge...

    you can get my sample here: https://www.rieperts.com/games/forum/LeftRightShift.capx

  • Try Construct 3

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

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

    the problem is that Construct 2 and 3 doesn't finish creating an object until immediately after the event where it is created.

    So, you have to wait until the next top level event before you can "pick" the object (because by then construct has added the object into its internal list of objects - making it pickable).

    there is nothing wrong with using functions as long as you understand that it is extending the event where the function is called from.

    that means if you have an event that calls a function that creates an object, and that function calls another function, or you call a second function from the original event, construct executes all those actions as part of that first event, and doesn't finish creating any new objects until the event is completely finished.

    The objects are automatically picked when you create them - the only way you can access the object from within a function call (within the same top level event as where it was craeted) is to pick the object by its UID. So you can pass the UID of the object to a function and use the UID to pick the object and work with it that way.

    The only other option I know of is to add a "Wait 0 seconds" before adding additional actions/function calls. What that does is wait until the end of the current tick to execute those actions - which counts as a new top level event, and at that point the objects can be picked.

    so, forget the wait for signal, try adding a "wait 0 seconds" before you call the second function.

  • pcgun007

    use the Drawing Canvas's "Paste Object" action, which is in the "Drawing: general" section.

    then you have to "Save image" which will trigger an event when the image is ready. My sample just downloads the image, but that is where you would send it to facebook...

    https://www.rieperts.com/games/forum/save_image.c3p

  • pcgun007

    you need to add a Drawing Canvas object, then paste the text object into it...

  • Vinzc

    you are probably loading the images into different instances of the same sprite object. All instances are just copies of the same original sprite, so they will all look the same - and show the last image loaded.

    you will need 4 different sprite objects. You can put them in a family, so the same code can be used - but each image has to go to a unique object.

  • RunningRazor

    I am not totally clear on what you are trying to do either... but I had to do something similar a while ago and this is how I did it...

    I do a lot with multi touch, so I like to create a "touchpoint" object to track the details about each touch (like where it started, how many ticks long the touch goes for, where it last was, how fast, etc.)

    this sample checks how fast and how far a touch goes for, and then sets the coasting speed and relative distance accordingly.

    https://www.rieperts.com/games/forum/coasting.capx

  • Dayvid86

    try this version I made that uses a sprite instead of a canvas...

    it also uses touch instead of mouse, so it will work on tablets and phones too.

    https://www.rieperts.com/games/forum/select.c3p

  • Ninjadoodle

    nice job! after a dozen tries or so I was able to light all the houses - with a score of 43.

    And the sound turned off when I asked it! :)

    but I noticed when I launch the game a second time it didn't remember my best time... is that supposed to be saved in local storage?

  • divertap

    it should be down at the bottom, under the web section...

    if you don't see it there, then you have probably already added it! (I know I have done that a few times)

  • locohost

    for some reason I thought you could make a family into a container... that would have solved your problem. But since that isn't an option, you might want to put all your monsters in one sprite object - and make a separate animation for each different monster. that way you can make the combined monster object into a container to hold the arrays. Then set the animation for the monster you want, and set any instance variable as necessary, and each monster object will have its own arrays as well.

    It is still a good idea to have a family as well - that comes in handy if you have to compare two monsters at the same time (you pick one from the object and one from the family).

    but, I just did a quick test... when you pick a monster by the family, the container objects (arrays) are NOT picked. They will only be automatically picked when you pick the monster by the object.

    if you DO pick a monster by the family and need the arrays, you would have to pass the UID into a function where you then pick the object by the UID...

    see my sample here...

    https://www.rieperts.com/games/forum/monster.capx

    you press a number key to create a monster (from 1 to 4 across the top of the keyboard - not on the number pad). Left click on a monster to pick it by the object to display his info. or right click to pick by the family... doing the right click didn't work properly until I made it call a function.

    EDIT. this method would be ok, if you don't have too many monsters, and the monsters don't each have numerous animations, and you typically use the same monsters on every layout - otherwise you might start to run into memory issues.

    an array can hold a lot of data! I don't really have a clear idea of just how much data you are trying to store for each monster. Rather than have a separate array for each monster, you might be able to have the monster's UID be the key to one large array. (an array can be three dimensional, so one array could hold a lot of data for a lot of monsters). Another option would be to just use instance variables - you can have a lot of those as well, and store a lot of data that way too...

  • I remember playing with the AirConsole plugin... it allows you to do that.

    the only other options would be to use the multiplayer plugin, or make your own websocket/node.js custom server... good luck with that!

  • locohost

    If you only have one instance of an array, you do not ever have to pick it.

    You can add multiple array objects and give them different names (just as you do with sprites), then when you refer to a particular name, you know which one you are working with. eg. playerArray.at(...) enemyArray.at(...) highscoreArray.at(...)

    you CAN use the System Create object to make additional instances of an array at run time... then you DO have to make sure you have the correct one picked. (You can give arrays instance variables which gives you addition ways tell instances apart).

    if you need to store an array of data for each instance of another object or family, you can make that object a container, and put an array object in the container. Then, when you create the object, the array gets created at the same time, and you will automatically have the correct array instance picked whenever the container object is picked. (and the array instance will be destroyed when the container object is destroyed).

    You can have a function return multiple values by concatenating them together (using a delimiter), and then use TokenAt to reference the value you need later... but that doesn't help readability.

    I like to use a lot of instance variables on objects, pass the UID of the object (and any input values as additional parameters) to a function to have it set all the instance variables as required. Then outside the function you reference the instance variables. That works best for self documenting. Using arrays is less readable because you have to figure out what each element of the array is actually storing. Although I have used dictionary objects to help with that, but that makes the lines of code even longer. I have also defined local variables to use as constants just to make lines of code easier to read... eg:

    name=0

    health=1

    strength=2

    set text to array.at(currentplayer, name)

    Set array.at(currentplayer, health) to 5

    ...

    (the variable definitions help document what is in the array. I also add comments at the beginning of every function to say what to pass in to the function, what the function does, and what it returns. If there is an array involved I will also have a comment defining what the elements of the array are - if I don't have the constants).

    but like I said, I would choose instance variables over arrays unless you have a very large amount of data to store for each object. And normally, I will have the objects in a family and put the instance variables on the family.