dop2000's Forum Posts

  • 2. Add event -> Audio -> Is tag playing. After that right-click this event and select "Invert". And voila - you get "Audio tag is NOT playing"!

    That's why I recommended to start with tutorials.

    As for other problems, I can't help you without seeing your project file.

  • You can add a variable PreviousMouseX=0 and do this:

    On Every tick
    Mouse.X not equal PreviousMouseX
    ....Set controlsType="kn&mouse"
    ....Set PreviousMouseX to Mouse.X
    
    
  • Self.X>Car.X?180:0 this means if camera.X>car.x, then the angle is 180, otherwise the angle is 0.

    abs(car.X-Self.X)*4*dt means absolute distance between camera and car (always positive value) multiplied by 4*dt, which is ~0.06

    So the camera sprite moves towards car sprite, and the bigger is the distance between sprites, the faster it moves.

    .

    Actually, now I realize that you don't need abs() and that formula for angle. Simply move (car.X-Self.X)*4*dt pixels at angle 0 - it will work the same.

  • Why are you doing this in such a complex and obscure way? Why not simply pick a random instance of the object and use it to spawn the projectile?

    System pick random Hyve
    ...Hyve spawn Projectile
    ...Projectile set angle of motion to 
    .. etc
    

    If you need, you can first pick instances of Hyve with IIDs 184-190 in this event. Although, hard-coding IIDs in events is a bad practice, it's better to use instance variables.

    Here is a demo I made quite a while ago for some other post, see comments in the code:

    dropbox.com/s/0jptlam49u7ugse/spawningDemo.capx

  • There shouldn't be any jerkiness with the first formula, although the correct method is to use dt: lerp(Self.X, Target.X, dt*5)

    The second formula should give you very sharp movement. At 60 fps dt value is ~0.016s, so (1-dt^0.075) gives you something around ~0.3, which means that the camera will cover 1/3 of the distance to target every tick. This is a lot, that's why this camera will follow the car almost instantly.

    You can also try something like this: lerp(Self.X, Car.X, abs(car.X-Self.X)/1000), this will give the camera slow start and slow finish. There are lots of other methods, but I don't remember them :)

    In C2 I also used MoveTo behavior for the camera instead of lerp. On every tick moving to target position with smooth acceleration and deceleration and limited maximum speed, it looked pretty good. MoveTo addon is ported to C3, so you can try it if you want.

    Here is a little demo to play with:

    dropbox.com/s/afrx680gfapj4yr/Lerping.capx

    .

    By the way, here is an excellent article explaining how cameras work in many popular game: Scroll Back: The Theory and Practice of Cameras in Side-Scrollers

  • I believe on a device without mouse, Mouse.X and Mouse.Y will always return 0.

    So you can simple check if they are not equal 0.

  • In construct it will look like this:

    System For "i" from 0 to 13
    ..System For "j" from 0 to 13
    .....System compare two values (loopindex("i")<=loopindex("j")) 
    .........Add 1 to counter
    
  • Can you write data to local storage and then load it from local storage in the same session? (without closing the app)

    If the data is lost only after closing the app, this probably means that android/ios allocates some temporary browser storage for it, and it gets reset between launches. This is only a guess, but if this the case, the best solution would be sending data to some online service, like Firebase.

    Why do you need the iframe? Why not simply export the game to a mobile app?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to give music audio a tag (for example "music"), and on start of layout check if "music" tag is playing. And only start music if it's not already playing.

    On start of layout
    ..Audio tag "music" is NOT playing -> Audio play music.mp3 with tag "music"
    

    As for the slider, you probably set it to move up and down in drag&drop behavior properties (if you are using drag & drop). Or made a mistake in one of the events (put "y" instead of "x" or something like that).

    I suggest you check out tutorials, there are tons of information for beginners:

    scirra.com/tutorials/top

  • 1. Edit the events in a source view so I can write a script that outputs the necessary code

    Yes, you can do this if you want. Events are stored in XML file in the Event Sheet folder of the project. You can make 250K events with a script and paste them into the XML. But I doubt loading and executing 250K events will be significantly (or at all) faster than loading the dictionary from big JSON file or local storage.

    I can easily split the files, but like I said in my previous post, why do I need to read this at runtime?

    If you split the database into many files, you can access them in runtime with very little lag, which you may be able to hide/mask from players with some visual effects and animations.

    I don't know how long does it take to load 18Mb of data. If this was my game and I had to choose between, say ~30 seconds delay on startup and 0.1 second lag every time when I need to access a word with AJAX, I would choose the latter. Of course, it depends on the game, if you need to quickly load hundreds of random words, this will not work.

  • One huge mistake in your project is event #4 - it's executed on every tick. You should move it to sub-event under event #3.

    I would definitely try splitting this database into about 1000 smaller files and forget about local storage. Simply read them with AJAX.

  • I think storing 250K+ separate keys in local storage is not a great idea. Your 18Mb will probably grow in size to hundreds of megabytes.. I would put all these keys into one (or several) dictionary/array and write it as JSON to local storage in one key.

    Also, JSON and especially XML format uses a lot of space. You should be able to decrease the size by at least 20-30% if you store this data in plain text format, say as comma-separated values. But of course, this depends on the data, and you'll need to write some functions to parse it.

    .

    Another approach is to split all this data into many (hundreds or thousands) small files and make some kind of an index. So when you need to access some word, you refer to the index to find which file contains it, and then request this file with AJAX.

  • I assume this is happening when using gamepad? As far as I remember, Gamepad.Axis expression returns a number from -1 to 1. So your maximum speed changes from negative 3 to 3. You need to multiply by at least 100 and use abs() expression.

    Also, I recommend using Browser Log to debug problems like this. If you'd tried adding "Browser Log GamePad.Axis(0,0)" into this event, you would immediately understand what's going on.

  • Yes, it only works one time. If you want to be able to click again and fill different random numbers, first you need to reset all color variables to 0 for all Dino sprite. Simply add "Dino set color=0" at the start of the event and it should help.

  • Add NWjs object to your game. This object has lots of actions like "Write file", "List files" etc.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/nw-js

    You will need to export your game for desktop, it will not work in the browser game.