DFORMS's Forum Posts

  • Hi Tarek, thank you for the info. I'll look more into fullscreen modes. I'm new to Construct so I left it on the default. Changing the mode to Scale Inner does reduce the flickering on the player, but like you say it is transferred to the background. Maybe resizing the layout to fit the background exactly may help. I will try that next. What are the modes you use most often when building your projects?

  • Well, I decided to scrap the lerp camera in my project for now. It's unfortunate because I really liked the effect it had. After reading on the subject, I have come to the understanding that Construct 3 isn't fully capable of supporting a lerping camera without causing variant degree of jittering (for platform games); At least not easily... I guess there's always a way, especially since you can add your own JavaScript to your projects etc. But, I wasn't successful in trying. Eventually, if I get it to work, I'll post the solution here.

  • Thank you for your suggestion Dop. I gave it a try and unfortunately it didn't prevent the jittering.

    Updated c3p: dforms.ca/c3/demo_v2.c3p

    I spent a lot of time looking for a solution and nothing worked out.

  • I use a lerp camera that smoothly follows the player. Whenever I stop moving while the camera is still moving, my player jitters for a bit until the camera stops moving. Any help would be greatly appreciated.

    dforms.ca/c3/demo.c3p

    Thank you for your time.

  • You're welcome.

  • I have resolved my issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glab I could help! Your grid is magnificent ; )

    To set and get the position of an enemy you could try this.

    runOnStartup(async runtime =>
    {
    	runtime.addEventListener("beforeprojectstart",() => OnBeforeProjectStart(runtime));
    });
    
    function OnBeforeProjectStart(runtime)
    {
    	runtime.layout.addEventListener("beforelayoutstart",() => OnBeforeLayoutStart(runtime));
    }
    
    function OnBeforeLayoutStart(runtime)
    {
    	//g_playerInstance = runtime.objects.Player.getFirstInstance();
    	var Player1 = runtime.objects.player.getFirstInstance();
    // 	console.log(Player1.x);
    	for(var i = 0;i<100;i++){
    // 	console.log(i);
    
    // 		runtime.objects.player.createInstance(0, runtime.random() * 1280, runtime.random() * 960);
    
    	const randomNumberX = runtime.random() * 450;
    	const randomNumberY = runtime.random() * 450;
    
    	runtime.objects.player.createInstance(0, randomNumberX, randomNumberY);
    	
    	// Or
    	
    // 	const clone = runtime.objects.player.createInstance(0, 0, 0);
    	
    // 	clone.x = runtime.random() * 450;
    // 	clone.y = runtime.random() * 450;
    	}
    	
    	const enemyOne = runtime.objects.enemy.createInstance(0, 475, 275);
    	
    	const enemyOneX = enemyOne.x;
    	const enemyOneY = enemyOne.y;
    	
    	console.log("Enemy X: " + enemyOneX + ", Enemy Y: " + enemyOneY);
    }
    
  • Hi Jsea, I'm new to C3 so I may not be the best person to answer your question, but try adding this to your for loop:

    const randomNumberX = runtime.random() * 450;
    const randomNumberY = runtime.random() * 450;
    
    runtime.objects.player.createInstance(0, randomNumberX, randomNumberY);
    	
    // Or
    	
    // const clone = runtime.objects.player.createInstance(0, 0, 0);
    	
    // clone.x = runtime.random() * 450;
    // clone.y = runtime.random() * 450;
    
  • Hi everyone, just want to mention that I am new to Construct. I spent most of my time understanding the event sheet system. I feel pretty comfortable with it now. So I started exploring the newly added scripting capabilities of C3. I'm progressing, but I hit a wall and I haven't been able to figure out how to move past it... I know some JavaScript but I am in no way a crack at it. Anyways, I would appreciate your help figuring out how to destroy a specific Enemy instance using the uid or other method. Here is my code:

    runOnStartup(async runtime => {
    	runtime.addEventListener("tick", () => Tick(runtime));
    });
    
    function Tick(runtime)
    {
    
    // 	const enemy = runtime.objects.Enemy.getFirstInstance();
    // console.log(enemy["uid"]);
    
    	// Test for collisions between enemies
    	for (const enemyInstance of runtime.objects.Enemy.instances())
    	{
    		CheckEnemySelfCollision(enemyInstance, enemyInstance.uid, runtime);
    	}
    
    	function CheckEnemySelfCollision(enemyInstance, enemyUID, runtime)
    	{
    // 		console.log("CheckEnemySelfCollision function called");
    // 		console.log(enemyInstance.uid);
    // 		console.log("Enemy ID: " + enemyUID);
    
    		for (const otherEnemies of runtime.objects.Enemy.instances())
    		{
    			if (enemyInstance.testOverlap(otherEnemies))
    			{
    				console.log("Enemies overlapping (" + enemyInstance.uid + ", " + otherEnemies.uid + ")");
    				
    // 				console.log(Object.getOwnPropertyNames(enemyInstance));
    				
    // 				Object.getOwnPropertyNames(enemyInstance).forEach(
    // 					 function (val, idx, array) {
    // 						console.log(val + ' -> ' + enemyInstance[val]);
    // 					 }
    // 				);
    				
    // 				enemyInstance.destroy(); // Will destroy both Enemy instances colliding. 
    				enemyInstance[enemyInstance.enemyUID].destroy(); // Uncaught (in promise) TypeError: Cannot read property 'destroy' of undefined
    			}
    		}
    	}
    }
    

    Thank you for your time.