dop2000's Forum Posts

  • For this task it's much easier when origin points are set at [0,0]. Here is the fixed project:

    dropbox.com/s/1e1mg705fx94xp8/align.c3p

  • Try this:

    But it's not a good idea to use Pin with Physics objects and to change their angle. This may cause problems if this sprite collides with other physics objects..

  • If the data doesn't change, you can upload it as a text file. Here is an example:

    dropbox.com/s/z8uno909mhefmvx/LoadJSON.capx

  • I believe it's runtime.objects["objectname"].getFirstInstance()

    Or you can add all objects into a family and pick Family instance by evaluating Family.ObjectTypeName="objectname" using "System pick by evaluate" condition

  • You can access variables and objects by string name using scripting.

  • When text changes in the text box, you can compare it with the previous text and figure out what key was pressed. But it may be tricky for Del/Backspace keys or when a character is added in the middle of the string.

    Another option is to make your own text input box.

    howtoconstructdemos.com/old-terminal-style-text-input-with-blinking-cursor-capx

  • When cursor is in the Text Input, you can only detect Enter and Escape keyboard events.

  • If you need to make the screen white for a fraction of a second, you can add a non-transparent layer above all other layers. Set it invisible by default. When player dies, set layer visible, wait 0.1s, set layer invisible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That should work. Please show your event sheet.

  • I don't know how to turn the torch off. Try the same code but with {torch: false} at the end.

  • I tried this script in "On button pressed" and it works on mobile.

    //Test browser support
    const SUPPORTS_MEDIA_DEVICES = 'mediaDevices' in navigator;
    
    if (SUPPORTS_MEDIA_DEVICES) {
     //Get the environment camera (usually the second one)
     navigator.mediaDevices.enumerateDevices().then(devices => {
    
     const cameras = devices.filter((device) => device.kind === 'videoinput');
    
     if (cameras.length === 0) {
     throw 'No camera found on this device.';
     }
     const camera = cameras[cameras.length - 1];
    
     // Create stream and get video track
     navigator.mediaDevices.getUserMedia({
     video: {
     deviceId: camera.deviceId,
     facingMode: ['user', 'environment'],
     height: {ideal: 1080},
     width: {ideal: 1920}
     }
     }).then(stream => {
     const track = stream.getVideoTracks()[0];
    
     //Create image capture object and get camera capabilities
     const imageCapture = new ImageCapture(track)
     const photoCapabilities = imageCapture.getPhotoCapabilities().then(() => {
    
     //todo: check if camera has a torch
    
     //let there be light!
     track.applyConstraints({
     advanced: [{torch: true}]
     });
     
     });
     });
     });
    
     //The light will be on as long the track exists
    
    }
    

    I guess it should work in C2 too, if you run it using Browser Execute Javascript action.

  • It doesn't matter.. Pin or add healthbar as a child to each character. You can use "Pick child" and update its width when needed.

  • If there was one elf sprite, the easiest solution would've been creating a container with the healthbar.

    With multiple sprites I suggest using the new scene graph feature.

    On Elves Created -> create a healthbar and add it as a child to the elf. When elves' health changes, pick child instance of the healthbar and update its width.

  • It's difficult to style form controls, and there are many other problems with them.

    Use TiledBackground object instead, it's very easy - just change its width.

    On every tick -> Bar Set width to 300*(Player.health/100)

    where 300 is the maximum width, and 100 is the maximum health.

    Here is another example:

    howtoconstructdemos.com/simple-healthbar