Troubles with Terraria style building mechanic...

0 favourites
  • 7 posts
From the Asset Store
Slot Machine Games. suitable for workers who work from home because it has player names that must be played alternately
  • Hey guys! I'm a longtime lurker here and I can't tell you how much everyone has helped me already! With the help of all the tutorials and the great forum posts, I've been having a great time designing my first game.

    I'm currently having an issue in a game I'm building (.capx attached). It's going to be a 2D, shooting platformer, but with a building aspect, like Minecraft or Terraria.

    As of right now, my player has 3 "modes"; Fight, Dig and Build. In Build mode I have it so when you press the left mouse button a terrain block spawns in front of you, and releases when you release the mouse button.

    I'm having a lot of issues with this, but my biggest two, at the moment, are as follows:

    Firstly, I'm using the "Pin" behavior on the block, and I'm not sure if that's the correct way of going about this. As of right now, based on your position when the block spawns, it will glitch out and push the player across the map. If you take a look at the .capx file this is easily reproducible; just move around a bit (left and right) before you spawn a block. It seems to work perfectly until then...

    Secondly, while the block is in your "hand", but before you release it, I have it so "Q" and "E" rotate the block so you can place it exactly how you want it. This works great, but only on the first block you place. It unfortunately also affects any previous block you've placed, which is needless to say very frustrating... This is also easily reproducible; just place more than one block and rotate a new one.

    I've run into several other issues so far, but I'm going to try to solve them on my own. I got this far, right? <img src="smileys/smiley1.gif" border="0" align="middle" />

    I'd LOVE for one of you guys to take a peek at the game and offer me any suggestions. Feel free to make any changes you choose!

    Thanks in advance, and I have a feeling you'll be seeing a lot of me around here!

    Link to .capx:

    mega.co.nz

  • use set position and compare the position in the conditions to select the block he's holding

  • Or give the object an instance boolean "placed", set it to true once the block is placed. Then on the rotate event, only rotate objects with boolean value false.

  • That sounds like the ticket! I'm going to give it a shot and let you know how it turned out!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Or give the object an instance boolean "placed", set it to true once the block is placed. Then on the rotate event, only rotate objects with boolean value false.

    That did it! Thanks a lot!

    I'm still having issues when the block is pinned to my hand though. When the game first starts it works fine, but after a while the spot on the players body that the block is pinned to seems to move...

    I think I might try permanently attaching a small invisible sprite to the player body and then pin the block to that...

    Here's my latest build with your block rotation fix added if you'd like to see :

    dl.dropboxusercontent.com/u/27880398/Soldiercraft%20Build%20618134/index.html

    Thanks again!

  • Newest build is up here:

    dl.dropboxusercontent.com/u/27880398/Soldiercraft%20Build%20618136/index.html

    I've gotten the block placement juuuuust about exactly the way I want it. You can at least use it to build properly now. I just spent the last 30 minutes burrowing all the way down to the bottom of the map and building stairs back up, lol...

    All I need now is to add buttons to alter the distance between player and block during placement but I should be able to figure that out <img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks again guys!

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