I need to know how to..

Get help using Construct 2

Post » Wed Jan 09, 2013 4:58 pm

Hey :)

I am making a terraria-clone, it's just minecraft in 2D. I am a newb to Construct 2, so i need some help to some things:

1: I don't know how to make the block break when holding down the mouse ON the object, and when you're not holding down the mouse anymore, it will stop breaking. (i got a breaking animation, so when animation is finished; Destroy)

2: If a block is 5 blocks away from the player, it can't be destroyed. How to make that?

3: When you scroll with mouse button, then you should select the item in toolbar. I have no idea how to make any of that, lol.

4: Is it possible to make a random world generation (i don't think so)

5: Is it possible to make multiplayer available, so that for example, the user download a server.exe and then put hamachi server in a properties file or something. Just like Minecraft.


Thanks! I hope somebody will help :)
- sorry my bad english, i'm danish.

- CXCX052013-01-09 17:14:28
B
5
Posts: 55
Reputation: 585

Post » Wed Jan 09, 2013 6:17 pm

1 & 2 - Simplified - "if player is overlapping block at offset (5, 0 )" and "toolSelected = axe" and "on mouse click" then start to destroy the block. 5 would check 5 pixels to the right on player, and -5 would check 5 pixels to the left.

3 - Again, simplified - "if toolSelected = scrollScreen" and mouse down then scrollTo...

4 - Of course it's possible ;) but right now, just get the basics in before going into advanced stuff like that. Create a prototype level of blocks and get everything working. Procedural generation can be implemented after everything is working. You're wanting to do stuff that seem to be more advanced than your capabilities. I mean, if you can't figure out how to smash a block, then you need to learn all that first. Check out the tutorials on this site. You'll learn loads from those in no time.

5 - I think there's a multiplayer plugin, but haven't bothered with MP myself so can't really offer advice.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Wed Jan 09, 2013 7:31 pm

Hey, thanks for the answer! I am not planning about doing anything random world generation stuff before i actually finish all the other stuff :), and yes, you're right, i don't really know anything yet, only the simple sheets. And i don't know anything about variables yet..

When you say "toolSelected" and stuff like that, then you men variables, right?

- CX
B
5
Posts: 55
Reputation: 585

Post » Wed Jan 09, 2013 7:45 pm

Yep variables. I did mention variables in my post but must've deleted that after editing to make it simpler to understand.

You'd probably have a setup like..

global constant variable TOOL_AXE = 1
global constant variable TOOL_SCROLL = 2
global variable toolSelected = TOOL_AXE

Then you can test with..

If toolSelected = TOOL_AXE ..

It's practically as simple as that ;)

EDIT> Although, I've simplified with just 2 "tools", you'd group tools together, like if you had a hammer, you'd probably set that to 2 and scroll to 3 or whatever.

The constant means the variable can't be changed at runtime and makes for easier reading.

And in the example above, toolSelected would actually just store the value of TOOL_AXE which is 1. It's much easier to read your code (as well as debug) that way rather than..

global variable toolSelected = 1
if toolSelected = 1...procrastinator2013-01-09 19:50:38
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Wed Jan 09, 2013 7:51 pm

Allright, i will play around with it :) Thank you!
B
5
Posts: 55
Reputation: 585

Post » Wed Jan 09, 2013 8:20 pm

You're welcome. Now go read some tutorials! Any problems, ask away. ;)
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Tue Jan 29, 2013 8:44 pm

Ok, my friend, now i am much better at using this engine! I love the way it works :D

But i am stuck, and my brain cant handle it. xD

I have a setup like this:
When left clicked on Grass, play breaking animation.
When breaking animation is finished, destroy Grass.

Now the problem is that i destroys EVERY grass block that i have pasted in..

Can you help, @procrastinator or someone else?
B
5
Posts: 55
Reputation: 585

Post » Tue Jan 29, 2013 10:03 pm

When you left-click on the grass get the UID (unique I'd) for the sprite.

CurrentUID = grass.uid

Wheb it us destroyed, select the grass with the uid that matches your CurrentUID and destroy that one.
B
13
S
4
G
3
Posts: 75
Reputation: 3,425

Post » Tue Jan 29, 2013 10:10 pm

or pick nearest to the mouse cursor !
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Tue Jan 29, 2013 10:54 pm

B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 18 guests