How do I make an object spawn on top of another object

0 favourites
  • 9 posts
From the Asset Store
Combine 3D forms like a half-sphere representing the sky, an elongated oval, a passageway resembling a tunnel, and assor
  • Hey there guys. I am making a game and I am wondering how to spawn an object on top of another object that is in another layout. What I basically mean is that I want to have a spawn platform on every level, and each time the object completes a level it will spawn on top of the spawn platform. So I am wondering how to make the object spawn directly in the center of it.

  • Do you have a .capx started we can look at? It should be simple. Maybe this thread can help you:

  • Hey there Xaiver. Thanks for the reply. I actually managed to make it work and I have a different problem now. Currently when the player gets a coin 1 point gets saved into score. Now I want that score to minus when the player dies on that level, but if he dies again on the same level I don't want the score to go into the negatives. I'll show you what I mean.

    So start on level 3 if you can. Basically when you get the coin it adds 1 to the score. Now, on that same level if the player dies I want the score to be reset to 0 so he can try again. But lets say for example he completes the level and gets the coin. His score would be 1 going into the next level. Now if he dies on level 4 I don't want the score to be touched because the player already got the 1 from the last level. It is really hard to explain and I hope it will make sense when you play.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure if I understood correctly. I've added an instance variable that checks if you have the coin or not. So if you die and don't have the coin, nothing happens to the score, and if you die and you have the coin, subtract 1 to the score.

    Tell me if this is not what you wanted and try to explain it again.

    By the way, you are using too many sprites and the system has to check a lot of collisions which is not good for performance. Instead of using a lot of small sprites, use the Tiled Background object, that way the system will only have to check very few objects.

  • I'm not sure if I understood correctly. I've added an instance variable that checks if you have the coin or not. So if you die and don't have the coin, nothing happens to the score, and if you die and you have the coin, subtract 1 to the score.

    Tell me if this is not what you wanted and try to explain it again.

    By the way, you are using too many sprites and the system has to check a lot of collisions which is not good for performance. Instead of using a lot of small sprites, use the Tiled Background object, that way the system will only have to check very few objects.

    Thanks again for the reply Xaiver. Let me clarify it better for you because it is really confusing to explain.

    So think of it like this. You start the level. You grab the coin. Your score is now 1/30 because you have 1 of the 30 coins in the game. Now lets say you go to the next level of the game with the score of 1/30 and die to something. Your score would go to 0/30 and you couldn't go back to get the coin. What I am trying to say is, is there a way to save the 1/30 after completing the level?

    Or if you possibly can, make it so when you get the coin it doesn't respawn and your score is saved as 1/30. Thanks again for your help, I have been stumped on this.

  • Try this one then, the coin doesn't respawn again (I made it a global sprite). The score is persistent between layouts, every time you die 1 point is subtracted from the score and it won't go lower than 0. Let me know if it has problems.

    I modified the position of some sprites just so I could test it, be sure to remove what you don't want.

  • The problem is though is lets say on level 3 there is a coin you collect. Before you collect it your score is 0/30 right? So when you do collect it, logically it is 1/30. Now lets say you beat that level and you score is 1/30. Now lets say again on the next level you die with that score of 1/30. Then your score would be 0/30 and I don't want that. I want it to be saved on the layer. Because you can't go back to that level and get the coin again.

    Basically what I am saying is once you grab that coin on level 3, i want the score to be saved on the next layer. but I am unsure of how to go about that.

  • Try this one. There is a minimum score now, if that's not what you want you should be able to modify it with the current events.

  • Yeah that works really good. The only thing is, is you took out the coin respawning and I am not sure how to get it back. I would still like it if you were to die that you lose a point in score and the coin respawns in the level. The main problem is gone which is the score is being saved upon beating the level and it won't go down if you die. Now the only thing is, is that what if there are two coins in the level? How would you make the score go down by 2? when you die on a level with 2 coins?

    Once again sorry for bothering you so much. I have read the manual and I have followed multiple tutorials. I am still learning.

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