How do I fix the portal mechanic and share my project?

1 favourites
  • 8 posts
  • Basically for some reason (even though the code for both of them is pretty much the same) going into the burrow exit takes me to the burrow entrance (so it works) but for some reason if I try to do the same but try to go through the burrow entrance, it doesn't take me to it (that or it just goes there for less than a second and then goes back)

    Also I would share the project here but I don't know how and since I am on a school computer, if I try to share it via google drive it says that only people in my school can access the link, so please tell me how I can post the file here so it can be easier for this and for my future problems.

    I would show screenshots, but I want to wait and see if I can share the project and I don't think the screenshots would help since I can't find the source of the problem

    drive.google.com/file/d/1zFw6skfVe_VOOjgSqnng4DkrNVOiEZmM/view

  • Without the project, I have to make a few assumptions. What I would suggest first is, make sure your character doesn't overlap the exit portal when teleporting to it. There is a chance that the character teleports but is immediately teleported back to the entrance portal.

    Ways to test would be to disable the exit portal events and just use the entrance portal. If the teleport works, check to see if the sprites overlap.

    If you disable the exit portal events but the character still doesn't teleport, there is something wrong with how your event is set up.

  • Without the project, I have to make a few assumptions. What I would suggest first is, make sure your character doesn't overlap the exit portal when teleporting to it. There is a chance that the character teleports but is immediately teleported back to the entrance portal.

    Ways to test would be to disable the exit portal events and just use the entrance portal. If the teleport works, check to see if the sprites overlap.

    If you disable the exit portal events but the character still doesn't teleport, there is something wrong with how your event is set up.

    Ok I did that and disabling the exit allowed the entrance to teleport it just fine, but I don't know what to do next and you said to check to see if the sprites overlap, but if the soul is overlapping it, how can I apply that to the code and fix it, and why is it only happening to the Burrow entrance? Also I got a link to the project and I was wondering if you can access it or not

    Thanks for the help and I am sorry it took so long to reply, I took a break

    drive.google.com/file/d/1zFw6skfVe_VOOjgSqnng4DkrNVOiEZmM/view

    edit: InDWrekt I wasn't able to share the file because when I try to share it with you, it says I can't share to people outside of my school, so I am going to have to go back to showing screenshots. Also I found something interesting and weird, when I swap the burrow entrance and burrow exit in terms of which one goes first (putting one on top of the other)the one on the bottom works but the one on the top doesn't

  • You haven't given public access to that project but I requested access. You will have to accept my request.

    That being said, You should take a look at the example mrcgkh posted in this thread. It uses an instance variable that gets set when the player enters the portal and only gets reset when the player is no longer touching a portal.

  • You haven't given public access to that project but I requested access. You will have to accept my request.

    That being said, You should take a look at the example mrcgkh posted in this thread. It uses an instance variable that gets set when the player enters the portal and only gets reset when the player is no longer touching a portal.

    It works now, but there is one problem, if I spawn the ray while part of or all of the arrow is outside of the walls, it freezes the game. How do I make it so that it doesn't do that?

    Also I need the arrow to face away from the soul

    like this whenever it is orbiting it

    but no matter what I do it is like this

    and I can't just have it in the right angle by default in the animation because if I do, the ray shoots off from the side and not the tip, and even if I change the angle in the properties area, it doesn't change

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First thing I am going to say is, you may want to take a step back and work through a few more basic tutorials before trying this project. You may not be ready yet. Each answer seems to lead to more questions which means you really could use some more experience with the engine (and game design in general). This isn't meant to discourage you. In fact, struggling with a bigger project than you are ready to complete is the more discouraging thing here and after getting some more knowhow first will lead to a better project in the end.

    That being said, Here is an example file that I hope can show you how to solve these problems.

    drive.google.com/file/d/1vXpKAC46NGnCxcb4O7n_P8i31WQ1m9dB/view

    The game freezing is caused by an endless loop. This means the while loop used to draw your ray is never finding an end point so it is continuing off into infinity. The events that happen after the loop are never reached and eventually the computer will run out of memory. This is solved simply by guaranteeing the ray stops growing at some point. In the example, I give it a max length as one of the conditions for the while loop. Any time you are using a while loop in your game, if the game freezes, the first thing to check is if there is an endless loop.

    Again, for the angle of the arrow, I will have to make some assumptions. I assume you are using the orbit behavior. This would seem to make sense because you want it to orbit the heart. However, some of the functionality of the orbit behavior (the way it rotates the object for example) is not compatible with the result you are looking for. For my example, I found it better to use the rotate behavior and set the origin of the arrow a little to the left of the sprite. To see this, edit the sprite and look at the position of the origin. If you then set the position of the arrow to the position of the heart, the rotate behavior will rotate the arrow around the arrows origin causing it to appear to orbit the heart. I then pinned the arrow to the heart, without allowing the pin to set the rotation, to ensure the arrow stays with the heart.

    There are of course other ways to fix the angle. For example, you could disable the orbit functions rotate property and use events to manually set the angle. But I'm lazy so I would rather not do that extra work.

    You'll notice the player uses a variable to ensure the teleport isn't automatically triggered on arrival at the end destination.

  • First thing I am going to say is, you may want to take a step back and work through a few more basic tutorials before trying this project. You may not be ready yet. Each answer seems to lead to more questions which means you really could use some more experience with the engine (and game design in general). This isn't meant to discourage you. In fact, struggling with a bigger project than you are ready to complete is the more discouraging thing here and after getting some more knowhow first will lead to a better project in the end.

    That being said, Here is an example file that I hope can show you how to solve these problems.

    https://drive.google.com/file/d/1vXpKAC46NGnCxcb4O7n_P8i31WQ1m9dB/view?usp=sharing

    The game freezing is caused by an endless loop. This means the while loop used to draw your ray is never finding an end point so it is continuing off into infinity. The events that happen after the loop are never reached and eventually the computer will run out of memory. This is solved simply by guaranteeing the ray stops growing at some point. In the example, I give it a max length as one of the conditions for the while loop. Any time you are using a while loop in your game, if the game freezes, the first thing to check is if there is an endless loop.

    Again, for the angle of the arrow, I will have to make some assumptions. I assume you are using the orbit behavior. This would seem to make sense because you want it to orbit the heart. However, some of the functionality of the orbit behavior (the way it rotates the object for example) is not compatible with the result you are looking for. For my example, I found it better to use the rotate behavior and set the origin of the arrow a little to the left of the sprite. To see this, edit the sprite and look at the position of the origin. If you then set the position of the arrow to the position of the heart, the rotate behavior will rotate the arrow around the arrows origin causing it to appear to orbit the heart. I then pinned the arrow to the heart, without allowing the pin to set the rotation, to ensure the arrow stays with the heart.

    There are of course other ways to fix the angle. For example, you could disable the orbit functions rotate property and use events to manually set the angle. But I'm lazy so I would rather not do that extra work.

    You'll notice the player uses a variable to ensure the teleport isn't automatically triggered on arrival at the end destination.

    Ok I did that and it solved all of my teleportation/arrow problems, thank you so much! and I will look through more tutorials to get more experience, so thanks for the suggestion and thank you for being patient, have a GREAT Halloween!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)