SuehtamSatierf's Forum Posts

  • I am working on a small 3D tank game project where I want the walls to have a lower opacity every time there's a tank (player) behind them.

    I tried several different ways using the position of the walls, trigonometry and bounding boxes, but nothing seems to work and I need help.

    Here's the problem!

    In the top-down view, I want the wall to get transparent when the player is behind (higher in the Y axis) the wall and within points A and B, which would be the width of a rectangle encapsulating the wall.

    However, I want the wall to be fully opaque when the player is in front (below in the Y axis) of the wall.

    So far, so good! The problem is that I want to avoid this problem, where if the player is in front of the wall but higher than its origin point in the Y axis, the wall will go transparent.

    The opposite should also be avoided when the wall goes remains opaque even though the player is behind it because they're below the wall's origin point.

    This would work very simply if all the walls were at right angles, but I want to be able to have a full range of rotation for them and make it work.

    Any ideas on how I could approach this problem and achieve the desired result? I tried many different things with varying levels of success, but never fully got there.

  • I am replying a bit late as I was taking a break from the project. Now I am getting back to it.

    I understand that I need to increase the player's speed to compensate for the platform's speed. That will be implemented soon.

    The main problem that I am struggling to figure out is why the problem in the video is happening. I checked on debug mode and apparently the player is pinned to the platform regardless of where on the surface of the platform he is, but he only gets carried over once he's at the edge of the platform.

    Link to the video:

    youtu.be/M7Y5EUZIrnk

    Any clue why that could be happening?

  • So, I tried the pin/unpin approach and it partially worked. The player did, in fact, move along with the platform and I was able to move while on the platform.

    However, seems like the player's speed is reduced and for some reason, the platform only moves the player if its sprite is on one of the edges.

    For example: if the player is moving from left to right, the platform will only move the player when the latter is at the left edge of the platform, meaning that the platform will move without the player until the player hits the left edge, and only then the player will move with the platform. From right to left, the opposite is true.

    Any clue on what could be causing that? I know that in the screenshot I am using a boolean to pin the player to the platform, but I also tried checking for the movement keys not being pressed and it didn't work.

    Code screenshot:

    Game screenshot:

  • Thanks, lionz! I will give it a try later today and let you know if it worked or not.

    Another thing that I thought of that I apparently forgot to mention in the post: any ideas on how I can keep the player within the platform even though they're moving?

    As in, they're on top of the platform, in the middle of their trip from point A to point B, and they can freely move, but they cannot go off the platform until it arrives to its destination.

  • I am making a top-down game where the player uses the 8-direction behaviour (it's actually a pseudo-3D game, but it works just like a top-down).

    I am trying to make a moving platform that the player can step on and move along with it, at the same time the player can control the character and move on top of the platform.

    I was able to make the platform move with no problem, but I cannot figure out how to get the player to move with it without locking it to the platform.

    Any ideas?

    Screenshot of my code for the moving platform so far:

    Screenshot of the game:

  • I have just tried the container approach and it worked like a charm. Thank you bigcatrik!

    I just created a container in the 3D object and included the sprite with the animation in it. Now, every time when the enemy spawn, the animation works.

    Screenshot of the game working:

    Screenshot of the container:

  • No, I haven't done that yet. I will give it a shot and I'll come back to say if it worked or not.

    Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Objective:

    The objective is to have enemy spawners scattered around the map to spawn new enemies every X seconds (a feature already implemented). These enemies are 3D objects with a sprite containing animations being projected onto the 3D object's bottom face. The objective is to have every new enemy spawned have the correct animations based on their angle. Example:

    If the enemy's angle is 45 degrees, the animation for that instance will be "Southwest_Idle", whereas if its angle is 0 degrees, the animation will be "East_Idle".

    The angle is determined by the Enemy's position in relation to the player.

    Current approach:

    For every tick, I set an instance variable called "selfAngle" in the enemy 3D object to angle(Self.X , Self.Y, Player.X, Player.Y). Then, I compare the value in that instance variable to check if the number stored in there is greater or equal to an angle and less than another (e.g. >= 0 and < 30). If that is true, the program set the correct animation accordingly.

    In terms of having the correct animation according to the angles, this is working.

    Problem:

    Since all the 3D objects being spawned reference the same single instance of the animation sprite, all the enemy instances face the same direction.

    A possible solution that I thought of was to spawn a new instance of the sprite containing the animations and project that specific instance onto the new corresponding 3D object that was also generated. However, I have no idea how to do that and need help.

    What could I do to solve this problem?

    Link for the C3 Project: