Hey guys. I’m trying to make some kind of ‘puzzle game’.
But i got stuck on how to make things work together, For example:
1.drag ‘left arrow’ or ‘right arrow’ or ‘1’,‘0’ from Area 1, and drop to Area 2.
2.press ‘play’ button, and game object will execute operations that in Area 2 in order.
left arrow – game object move left 1 ---- one of cell in game object was set to 1
right arrow - game object move right 0 ---- one of cell in game object was set to 0
I’m not sure i make it clear to you guys, and It should be simple but i have no clue how to do it right now, anybody could recommend some tutorials or ways to do it? Thanks!!
I get what you’re trying to do. It’s something like Light Bot, but (from your drawing) it looks more like you’re programming a Turing Machine.
So, this is a pretty advanced project. But I’m sure you can handle it if you can break it down into parts:
make UI objects you can drag around
make a “well” or source of UI objects that, when you click 'em, creates a new one for you to drag
make a “drop target” UI area that accepts dragged objects and snaps them to a proper position
make dragged UI objects disappear if dropped anywhere other than on a drop target
Note that when you get to this point, you’ll have your basic UI for defining the program. Now you need to execute it! Again break the problem into smaller, bite-sized chunks:
print out (with Debug.Log) the items in the drop targets, in order
write code to do each of the operations (move left, move right, write 0, write 1)
oops, to do that you need a model of the tape, with 1s and 0s on it
execute each of the items in the drop targets, waiting until each operation is done before doing the next
It’s all quite a bit of work, but if you take it one step at a time you’ll get there, or at least level up your skills a bit!
The UI parts i’m kind of figure it out, And now what i’m trying to figure out is how i’m gonna know what ‘drop target’ have, and how am i gonna do something with it. Means make the UI connect to game object, should i do it through name or something, still thinking.