Troubles with Terraria style building mechanic...

Get help using Construct 2

Post » Tue Jun 18, 2013 2:10 pm

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?


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:

https://mega.co.nz/#!14wTACzL!VP53a3n6yixw1B9aH5fe1ihEY65GXkP6N2_E9VbE_e4monsterZERO2013-06-18 14:34:45
B
5
Posts: 6
Reputation: 314

Post » Tue Jun 18, 2013 3:22 pm

Dropbox link:


https://dl.dropboxusercontent.com/u/27880398/Soldiercraft%20Build%2061813/Soldiercraft%20Build%2061813/index.html
B
5
Posts: 6
Reputation: 314

Post » Tue Jun 18, 2013 7:45 pm

use set position and compare the position in the conditions to select the block he's holding
B
41
S
11
G
7
Posts: 514
Reputation: 9,706

Post » Tue Jun 18, 2013 7:49 pm

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Jun 18, 2013 9:43 pm

That sounds like the ticket! I'm going to give it a shot and let you know how it turned out!
B
5
Posts: 6
Reputation: 314

Post » Tue Jun 18, 2013 10:57 pm

[QUOTE=Nimtrix] 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.[/QUOTE]



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 :

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



Thanks again!
B
5
Posts: 6
Reputation: 314

Post » Wed Jun 19, 2013 3:54 am

Newest build is up here:

https://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


Thanks again guys!
B
5
Posts: 6
Reputation: 314


Return to How do I....?

Who is online

Users browsing this forum: WesleyDeveloper9 and 1 guest