x


[Closed] how do i make a script that can be applied to blocks and mine them like in minecraft

im trying to make a game like minecraft but im having trouble with some things how do i make a script that all i have to do is add it to a cube and set how strong it is like dirt or stone intesity and add it to a invetory plz help

more ▼

asked Jan 26 '12 at 12:14 AM

kidrockkenny gravatar image

kidrockkenny
1 6 11 13

(comments are locked)
10|3000 characters needed characters left

The question has been closed Jan 21 at 10:24 AM by Fattie for the following reason:

Duplicate Question


1 answer: sort newest

Something along the lines of

var cubeStrength : float;

function OnCollisionEnter() {

 cubeStrength --;

if (cubeStrength <= 0) {

   Destroy (gameObject);

} }

Simply apply this code to the cube, set a strength in the inspector window (higher number for stronger material).

Each time you hit the cube the cubeStrength will be decreased by one point. Once the value hits 0 it will be destroyed.

more ▼

answered Jan 26 '12 at 12:47 AM

OutRage_Studios gravatar image

OutRage_Studios
41 2 2 4

thank you ill give it a try but when i make a new script for it do i delete everything there and just put that in and is it c++ or java sorry i am a newbie but im trying to learn

Jan 26 '12 at 09:26 PM kidrockkenny

thanks guys it worked

Jun 02 '12 at 01:43 PM kidrockkenny
(comments are locked)
10|3000 characters needed characters left

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x101
x43

asked: Jan 26 '12 at 12:14 AM

Seen: 588 times

Last Updated: Jun 02 '12 at 01:44 PM