How do I create a building in clicked sprite?

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi, i have the following problem:

    I have 3 layers

    a/layer island with 6 sprites of grass (all the same with diffirent instance var) and i want to build a building when you click on any of them (and open the building layer like pop-up)

    b/layer background

    c/layer buildings that player clicks on 2 type of buildings and suppose create one of them at the last potition of the grass clicked

    i set position of x and y at grass and i declare at what layer and x,y co ordinates the new building must be created but the building always build in the same position (1st grass sprite)

    i click the grass sprite then layer opens to choose building to create ,i click on building and builds at same grass sprite all time

    how can i make the actions so the new building creates in the last position clicked? in any grass sprite that i choose and click?

    ty

  • ............

  • Thank you very much. I havent realize that so much work needed to make this. Now i can see the logic.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im searching it and the spawn object maybe it solve temporarilly the problem but for sure it isnt the correct method.

    The correct method should be:

    a/click on grass (any) and somehow his x,y coordinates saved-stored (temporarilly) somewhere, then

    b/i click at the pop up object i want to create and give order to create it at those specific x,y coordinates of grass.

    For sure must be a way to code it . Why to make an intermidiate object and then replace it?

    Wherever i click a sprite, the coordinates must be stored and then applied to the new object that i want to create so it could be positioned to the specific place

    Any ideas?

    ty

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