AllanR's Forum Posts

  • That is awesome! very well done!

  • Awesome! I will try that out in a few minutes.

    Thanks!

  • I need to load an external image into a sprite and allow the user to resize and crop it. I got that working pretty well with the FileChooser, DrawingCanvas, and BinaryData. But if the original image is really big the final result looks terrible.

    So, I went looking for a javascript routine that can resize an image without all the artifacts, and I found one that does a great job! I can have the script load an image and resize it, and load that into the DrawingCanvas object. But I can't find a way to send the image from Construct to the script...

    I can load an image into a sprite, paste that into the DrawingCanvas, and save that to BinaryData, and access the BinaryData object in the script, but I don't know how to load that into img.src or an ImageData variable that the script can work with.

    Is there a getImagePixelData (opposite of loadImagePixelData) for the DrawingCanvas?

    Anyone know how to get image data in the BinaryData object loaded into an img element?

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

  • sounds like a picking problem. If more than one of the "Container" objects is picked, then it will only compare the water.value to the first of the container objects unless you do a For Each container loop, or use some other method to make sure you are comparing to a single object.

  • the controls are anchored to the viewport edges (at the start of the layout), but then the car has scroll to which moves the camera to the bottom of the layout - so the controls are now way off screen.

    since you want the controls to always be on screen, make a new layer, with parallax 0%, 0% (so that it doesn't scroll). put the controls on that layer - and move them up to the top of the layout so that they are within the visible area (above the dotted line).

  • looks like this might be an option...

    -webkit-touch-callout: none; /* iOS Safari */

    -webkit-user-select: none; /* Safari */

    -khtml-user-select: none; /* Konqueror HTML */

    -moz-user-select: none; /* Old versions of Firefox */

    -ms-user-select: none; /* Internet Explorer/Edge */

    user-select: none; /* Chrome, Edge, Opera and Firefox */

    but I think it is a bad idea to try to force a form control to do what you want here. I would make my own out of sprites... especially if people will be using this on a mobile device.

  • I didn't mean anything to do with CSS, you can set the TextInput to Disabled in the layout properties bar, or with a C3 action. Then the user can't click on it to highlight text or have the control intercept keyboard presses - which can still happen if it is on screen and just invisible.

  • you could try setting it to disabled, or have it be off screen...

  • one minor little difference...

    event seven - in C3 you set value at Loopindex to aleatorio

    in C2 you set value at ateatorio to Loopindex.

    so, it should work fine after fixing the C3 version, but I would do this a little differently - put the numbers in the array in sequence, and then loop through the array and randomly swap them with a different location (so each value gets moved at least once), or put them in one array and randomly pull one out and put in a second array until there are none left in the first array.

    this way seems inefficient because it forces it to repeatedly pick a random location to put loopindex until it finds an empty location, which could take a while, especially for the last few spaces. The bigger the array, the less efficient it would get. For a small array you wouldn't have a problem though...

  • when you create an object, the process doesn't complete until the next top level event.

    your "on start of layout" event loops through each spawner, creating a new tiledbackground object, but those objects wont be ready until event 4 is completely finished.

    so, in your code, event 3 was trying to pick the family object by its id2 variable, but that will fail because the new object is not ready yet. Only the pick last created, or pick by uid will work at that point.

    putting a wait 0 seconds as an action will defer other actions under that until the end of the current tick, by which time the new objects will be ready, but people quite often create other problems if they don't use that properly.

    you were using iid which is not as reliable as uid. iid for an object will change if you destroy an earlier instance of that object. the uid will not change, and is the same for the original object and the same object under the family name.

    so, picking by the variable would have worked fine - but not until the after the object is fully created.

  • well, baby steps... if you start getting anywhere near 1 billion you will have to do some major back end scaling and should be able to afford a large team of developers that you can delegate that task to.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sounds like you might have locked the layer the sprites are on. on the layer panel, see if you can click the little lock icon to unlock the layer.

  • you could set a limit of how many players can join a game, and have enough frames to cover that - 10, 20 50, whatever your limit is.

  • the reason you need the wait 0 is that object creation does not complete until the next top level event.

    so, in your case event one must completely finish before the objects created in the function can be picked by "normal" means. (you can pick by UID or Last Created before then)

    adding the wait 0 defers actions until the end of current tick - which means the event that created the objects has completed.

    you could add another event to call the second function, but to do that you would have to set up some kind of trigger for that, which would only add more trouble than the wait 0.

  • you are probably creating an infinite loop.

    make sure a while event has a way to get out.

    since the event sheet runs every tick there is also a very good chance you don't need while - as long as the main condition is true the event will keep running every tick without using while.