mathew653's Forum Posts

  • I am unsure if this is a bug or not but I have been finding strange delays between transitioning between layouts, using the built in chrome performance tools I see gaps where there almost nothing happening for a good 500ms or so.

    The minimal setup I have been able to reproduce this with is a layout with a few sprite objects that transitions to a tilemap, with a sprite object used as the background when clicked.

    I am using windows 10 and construct 2 r278, if there is any advise on what could be causing this and how to address it, I would be happy to hear.

    Currently I can not tell if this is a bug or not so I am posting as a general question to what it is these delays might be?

    (Attached image of a performance profile done via nw.exe on the preview instance)

  • Hello, a quick update to the solution I did, while not a perfect solution if one is changing zoom, it might be of use to someone else to know the slightly odd means that I used, with a few tweaks you can even tweak it to find each edge.

    The camera region its self was a 1x1 image, with four image points representing its edges, it also contained information for how much to offset the camera by on the Y axis(one can also add the X axis to the same concept).

    Then each tick, from the players position(Not the invisible object representing the camera) I checked a point using a system statement exactly 128 pixels under the player(used 128 as it seemed to cause the least amount of camera snapping as I lerp the camera), if the statement picks more then one object in the particular group, it will use its top image point-Y offset to position the camera, otherwise use the players X and Y.

    If this confuses anyone I will see if I can clean it up, likely a bit rube Goldberg for most cases.

  • Alright, this is kinda a catch, been trying to make a camera in construct 2 work by having an object type define areas the camera is not allowed the scroll into but the camera should also track the player so the camera will need to treat the blocking objects as if they are edges of the layout.

    Currently I have the camera set every tick to center on the player, so I can calculate the position before I commit it to the layout.

    Thanks in advance for any help.

  • Hey, thanks fixed the wind but I've got a related problem, after adjusting the deceleration and acceleration I still have the issue, that the player can control them self too much when turning and the velocity don't push against the player when they turn.

    (kinda hard to explain, thinking I might need to lerp the speed or something.)

  • I have been having two issues while working on my 2d platformer project.

    The first being wind:

    Applying velocity via setting the dx var or the set velocity x action appears to not influence the player at all yet if i apply it via the dy or set velocity y it does.

    The second being ice physics:

    I currently have the platform setup with deceleration but, there is no momentum on turning how could I do this best without using the physics behavior as I need to support slopes as well.

    If there is more info needed or I am unclear, just say and I will clarify on request.

  • Hello, I will start by mentioning that I had created a icy surface and when the player is over it his deceleration is set to 50, this produces the slide effect but, when the player moves left or right there is no resistance momentum like in many platformer games.

    I have fiddled around with a few calculations influancing the DX and DY of the player but in all cases have't found a way that feels right.

    Anyone here know a good way to add this sliding momentum(I do not know a good way to explain this)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright, I am writing a camera plugin, so far I have it working for controlling the camera and such but, construct classic's zoom behaves weirdly at 200% zoom(X and Y zoom are the same) it appears off by the camera area divide by 2, yet at 300% zoom it is off by an entire screens worth.

    Now I only need 200% zoom but I would insight into what the bug is exactly I am looking at, I feel it'd be better to make a flexible solution over a patch over.

    This is using the system zoom and the latest not modifyed construct classic as a base.

  • This is posted in the - now retired - Construct Classic section.

    Is this what you intended?

    Yea, the plugin work is related to construct classic's engine.

  • So far using the built in platform plugin I found it to be very usful, that was until I started to add ladders, I was able to get the correct animations working for the player but, the jump bugged out using the built in tags this worked fine but broke the ladders, so I took a look into the platform code to suppress playing of the ladder animation, so far it was as simple as going to ExtObject::OnFrame and to line 1250 adding the following in place of the single call(also added a set and unset flag what simply does a bitwise operation to enable and disable the altered behavior) :

    if (ExtendedFlags & MT_ExtraFlags::EX_FLAG_ONLADDER) { }
    else { SetAnimation(jumping); }
    [/code:3n3uuwid]
    
    for the sake of all this all MT_ExtraFlags::EX_FLAG_ONLADDER means is 0x01
    
    But now I get a weird bug what did not occur where if i drop down off a platform or jump onto a ladder instead of climbing from the floor when i climb up the animation frames will not increment I also get the same effect doing this check from within the is jumping condition.
    
    Edit: Manged to fix the bug, it was not related to the plugin but rather the event sheet(On dropping from a platform and midair attach I forgot to set the plugins ladder flag but had set the OnLadder private var I was using).
  • First off I have tried finding existing examples of plugins what interact with the camera, but so far have not found any only in source form(such as magicam, good plugin but lacks curtain features I need for the current project)

    What I plan to do is write a camera plugin that can use defined areas as a single flowing bounding box, so I can move the camera freely within a set of rectangular shapes(Magicam came close with the megaman style scrolling but is not 100% what is needed but i will be using that in the future most surly).

    Can anyone point me in the right direction for manipulating the camera from within a plugin?

    That or source code to a plugin close to Magicam.

  • I have been developing a game and again I noticed that sometimes the jump animation seems to frame skip I am wondering what the best way is to ensure the animation plays to its end.

    Again thanks to all, many things are working great.

  • Hey, what is the best way in construct classic to make a door or a moving platform.

    At the moment I am using the physics behavior but it often overshoots its mark.

    Ideal thing would be a platform that can go from A to B to C to D in sequence.

  • Hopefully I got the right sub forum as this is more to do with the actual python logic code and/or controlling event sheet.

    While working with construct i created a variation of the 8dir behavior to allow an event sheet to control it all is working but the a.i is not perfect, at this time it is not correctly going to the last location the ball goes off screen, then resuming its normal behavior once it has deflected the ball, rather maintaining its normal behavior, in addition a minor flaw i suspect is that the movement is not taking acceleration into account.

    I have two bats, one being the player on the left of the layout using a an 8 direction behavior for movement, the other being a a.i bat using a modded 8 direction movement that allows me to send input via the event sheet(so both are using the same movement setup, just ones using a pretend keyboard).

    They have a max speed of 500, a acceleration of 600, a deceleration of 600.

    The ball uses the stand ball behavior with a speed of 300 and a max speed of 1000.

    The event sheet responsible for the a.i has the following(python script included)

    [quote:1kh8siwa]LIB - On function "AIStop" AIBat : Move stop

    LIB - On function "AIUp" AIBat : Move Up

    LIB - On function "AIDown" AIBat : Move Down

    #This script controls the core logic
    #For the Bat AI
    import random;
    
    AI_Enable=1;
    
    AI_LastOutY=0;
    AI_TargetY=Ball.Y;
    AI_BallAngle=int(Ball.Angle);
    
    AI_MaxRandom=5;
    AI_MinRandom=0;
    #AI_ReactionDistance=16;
    AI_ReactionDistance=12;
    AI_NoCompensate=0;
    AI_AdjustRate=2;
    
    def AI_AdjustToAngle():
    	global AI_AdjustRate;
    	global AI_BallAngle;
    	if ((AI_BallAngle > 90) and (AI_BallAngle < 180)):
    		return AI_AdjustRate;
    	else:
    		return -AI_AdjustRate;
    	return AI_AdjustRate;
    
    #Track last area ball whent out of.
    def SetBallParkArea(val):
    	global AI_LastOutY;
    	AI_LastOutY=val;
    
    #On/Off switch for player 2 a.i
    def EnableAI(arg1):
    	AI_Enable=arg1;
    
    #Give a bit of randomness to the a.i reaction distance.
    def AI_GetRandomiseMidFeild():
    	#return random.randint(0, 5);
    	return 0;
    
    #Skill related, tells our a.i how much
    #to compensate for the ball.
    #Take into account the balls angle here
    def AI_GetCompensation():
    	global AI_BallAngle;
    	global AI_NoCompensate;
    	global AI_MaxRandom;
    	global AI_MinRandom;
    	
    	if (AI_NoCompensate == 1):
    		return 0;
    	
    	if ((AI_BallAngle > 90) and (AI_BallAngle < 180)):
    		return random.randint(AI_MinRandom, AI_MaxRandom);
    	else:
    		return -random.randint(AI_MinRandom, AI_MaxRandom);
    	
    	return random.randint(AI_MinRandom, AI_MaxRandom);
    
    #A.I think loop
    def AI_Think():
    	if (AI_Enable == 0):
    		return;
    	
    	global AI_BallAngle;
    	global AI_TargetY;
    	global AI_NoCompensate;
    	global AI_ReactionDistance;
    	global AI_LastOutY;
    	
    	#Its on the players side of the playing feild, wait for it to come to ours.
    	if (Ball.X < (320-AI_GetRandomiseMidFeild())):
    		LIB.Call("AIStop", 0);
    		return;
    	
    	AI_TargetY=Ball.Y;
    	AI_BallAngle=int(Ball.Angle);
    	#For now disable A.I compensation
    	AI_NoCompensate=0;
    	
    	#Always goto the last spot the ball whent off screen at for the a.i bat.
    	if (AI_LastOutY != 0):
    		AI_TargetY=AI_LastOutY;
    		AI_NoCompensate=1;
    
    	AI_TargetY += AI_GetCompensation();
    
    	#Adjust in relation to ball angle.
    	#AI_TargetY += AI_AdjustToAngle()+AI_GetCompensation();
    	
    	#Adjust our position to line up with the ball.
    	if (abs(AI_TargetY-AIBat.Y) > AI_ReactionDistance):
    		if (AI_TargetY > AIBat.Y):
    			LIB.Call("AIStop", 0);
    			LIB.Call("AIDown", 0);
    		if (AI_TargetY < AIBat.Y):
    			LIB.Call("AIStop", 0);
    			LIB.Call("AIUp", 0);
    	if (abs(Ball.Y-AIBat.Y) < AI_ReactionDistance):
    		LIB.Call("AIStop", 0);
    [/code:1kh8siwa]
    [b]Ball - Is outside layout[/b] System : run script "SetBallParkArea("+str(Ball.Y)+");"
    
    [b]abs(AIBat.X-Ball.X) greater than 8
    On collision between Ball and AIBat[/b]  System : run script "SetBallParkArea(0);"
    
    [b]Always(every tick)[/b] System : run script "AI_Think();"
    
    
    
    Any help or advise would go a long way.
  • Thanks again for the help provided so far, it has been a blessing.

    I have another question, currently i plan to do ledge climbing like so

    Create an invisible sprite that when touched disables the players normal jump replacing it with an animation what is not affected by gravity, where the player jumps off the ground and climbs up a ledge.

    Now on construct, collision is handled per pixel but the physics engine is box2D(as far as i understand), so if i set the player platforms gravity to -1 will this make it static for the course of the animation?

    Another concern, am i making this too complicated? Is there a simpler way and/or a plugin that will do the dirty work for me?

  • Thank you for your response so far, I have found the information very helpful, Still trying to get the camera to default its zoom at 200%, but you have put me on the right track with other elements.