Hello. I am currently looking for some help with a ‘game’ needed for part of a university project. I don’t feel it should be too difficult, however I have yet to ever make a game. Also, I will note that the game isn’t part of anything like a computer course, and is instead for psychology and the university would rather it be computer generated rather than physical (which quite frankly is frustrating).
To the ‘game’! If anyone could tell me how to, or send me a link to a tutorial showing me how to do the following I would be most grateful.
- Producing a 3D cube made of 125 (5x5x5) smaller cubes.
- Allowing a person to rotate the 3D cube in 3D space within the ‘game’
- Having it so that clicking on one of the smaller cubes removes that cubed.
- The ability to undo a click so the cube reappears (Not entirely needed)
Thankyou.
(Also if this is the wrong thread then could a moderator move it please? Thankyou
)
Create a new scene. Create a cube. Duplicate that cube 124 times, rearranging them into a giant cube.
Create a script that rotates the view with the mouse movement. There might be a built-in script that you can use, but I’m not sure at the moment.
Create a script on the cube that detects when it’s click, and deletes itself. I’ve seen this script a few times, so I know you can find it if you don’t want to figure it out yourself.
Undoing a click is harder. You’d need to change how you’re removing cubes. Instead of destroying them, just hide them. Then, store a list of the cubes clicked. When someone hits ‘undo’, use the last entry from that list to re-enable the cube and remove it from the list. If there’s nothing in the list, do nothing.
That’s all the logic you need for your game, and you should be able to use basic tutorials to learn everything you need.
warning contains spoilers, but not complete solution
// hint 1
Queue actions;
// hint 2
ActionManager.UndoLastAction();
ActionManager.RedoLastAction();
// hint 3
public class CubeDelete : IAction
{
private Cube cube;
void Undo();
void Redo();
}
public class Cube
{
public Mesh mesh;
void Hide();
void Show();
}
Record your transactions in a class (like CubeDelete).
Have an ActionManager class that is capable of recording transactions.
Well I’ve given it my best go but I’m still stumped. I found a ‘remove on mouse down’ script and added that to it but it didn’t like that and produced script errors. When I pressed ‘Play’ the cubes all disappeared and you couldn’t see anything.
Am I best off creating one cube, adding the ‘remove on mouse down’ script to that and then copying it over and over?
And how do I get it so that when I ‘play’ they’re still visible?