SoupOrWorm's Recent Forum Activity

  • It took me all night to figure out, now I know Js :p

    I've tried uh, borrowing your code and I keep getting this error:

    Uncaught ReferenceError: mouse is not defined at HTMLDocument.<anonymous> (main.js:17:69)

    This is the code:

    // Import any other script files here, e.g.:
    // import * as myModule from "./mymodule.js";
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    });
    
    async function OnBeforeProjectStart(runtime)
    {
    	// Code to run just before 'On start of layout' on
    	// the first layout. Loading has finished and initial
    	// instances are created and available to use here.
    	document.addEventListener("mousedown", (e) => {e.preventDefault(); mouse(e.clientX, e.clientY, e.button)});
    	
    	
    	runtime.addEventListener("tick", () => Tick(runtime));
    }
    
    function mousedown(x, y, button){
    console.log(button);
    }
    
    function Tick(runtime)
    {
    	// Code to run every tick
    }
    
    
    

    Do you know what this is about?

  • Maybe you could do the parallax manually. Just need two instance variables: startx and rate. Then you could do something like this:

    Start of layout
    — sprite: set startX to self.x-scrollx*self.rate
    
    Every tick
    — sprite: set x to self.startx+scrollx*self.rate

    Maybe tweak the start offset as needed.

    This is perfect, thank you!

  • I know that this has been asked before, but I need to set the paralax for multiple individual objects, and I can't just add more layers because that would mess up a bunch of stuff in my event sheets.

    If anyone has an idea of how to set the paralax of an object, either through events or otherwise, please let me know.

    Tagged:

  • Unfortunately the side buttons are detected as browser back and browser forward not as inputs.

    Intresting. If they are detected as forward and backward, does that mean that they may be able to be used in conditions still?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, I'm tryna add keybinds to my game and I think I have the keyboard (and most likely mouse/gamepad) side of things figured out, but I am wondering if I can bind things to the buttons on the side of my mouse. I know that they obviously arent the same between mouses (mice?), but I have seen other games do it so I just want to know if it's possable in C3.

    Tagged:

  • I just made a seprate prototype. I t seems to be working a bit better, but it skips over some clips for some reason when playing back. dropbox.com/scl/fi/5aqfz7whw5pxq11h3l88h/videotest.c3p

  • This works fine for me?

    Can you send me that project file? I don't know why it isnt working for me.

  • Yeah, I think I have everything figured out but how to play a video in-game from VideoRecorder.RecordingURL without downloading it. Is this possible?

  • No idea, I'd have to try the project. A different although silly idea I had was to record 30 videos at the same time, all offset by 1 second. So when a highlight is requested you can just save the most recent one. But that's kind of an absurd solution.

    I also found some js implementations of ffmpeg, perhaps something could be done with this?

    1. Here is the project file: dropbox.com/scl/fi/pfykdekmpj93dgk2gh97w/snapshot-project-test.c3p

    2. That actually could work... I'm just wondering what would be the best for performance and it's probably not that lol

    3. I actually wondered if there would be any way to use ffmpeg, but I doubt I could figure out how to use it.

  • I think I'm onto something here, but the video isn't playing. Feedback?

  • Wait. I have an idea for how to stitch together the clips. What if I recorded the 30 1-second chucks in arrays (as shown in my demo project from earlier) and then had construct 3 play those clips back-to-back while I recorded the screen. Then I download the recording of the clips playing. Ima try this out...

  • I gave my idea a shot but unfortunately I'm running into the issue that I cannot just discard older chunks. I'm assuming the first chunk aka the beginning contains some vital information/header, so the recording gets corrupted once the 30 second mark is passed because that first chunk gets removed. Keeping it also does not properly work and just creates some nice visual glitches in the resulting video if it works at all.

    I found very little information on this and no real solutions. Not sure if there is some kind of magic one could employ to get this to work. The only possible solution I saw (although in a different context) was this stackoverflow.com/questions/42127276/trim-or-cut-audio-recorded-with-mediarecorder-js

    But I have no clue how to actually implement this since it's for audio and not video.

    I can't post the c3p right now but here's the relevant js code which almost works but alas.

    > 	export class ReplaySystem {
    	constructor() {
    		this.stream = document.querySelector("canvas").captureStream();
    		this.highlightDuration = 10;
    		
    		this.mediaRecorder = new MediaRecorder(this.stream, {"mimeType": "video/webm"});
    		this.mediaRecorder.ondataavailable = this.dataAvailable.bind(this);
    		
    		this.replay = [];
    	}
    	
    	startRecording() {
    		this.mediaRecorder.start(1000);
    		console.log("Recording started");
    	}
    	
    	stopRecording() {
    		this.mediaRecorder.stop();
    		this.replay = [];
    		console.log("Recording stopped");	
    	}
    	
    	addChunk(chunk) {
    		this.replay.push(chunk);
    		if(this.replay.length > this.highlightDuration) {
    			this.replay.shift();
    		}
    	}
    	
    	dataAvailable(ev) {
    		this.addChunk(ev.data);
    	}
    	
    	captureHighlight(runtime) { 
    		const highlight = new Blob(this.replay, {type: 'video/webm'});
    		const url = URL.createObjectURL(highlight);
    		
    		runtime.callFunction("downloadHighlight", url);
    	}
    }
    

    Yeah, I don't know JS so I can't provide much feedback, but thanks for trying it out. I suppose if this doesn't work I can just make a system where the game records a whole level/session automatically, and you can use a button to download the recorded clip, but that isn't as cool in my opinion so I'll keep my eyes open for a solution.

SoupOrWorm's avatar

SoupOrWorm

Member since 7 May, 2021

None one is following SoupOrWorm yet!

Trophy Case

  • 3-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies