I'm working on a minecraft game and i'll need help spawning mobs and infinite terrain
how do i do this?
Offline
You will need lots of lists and stamping/cloning (in 2.0). Your question needs to be more specific though. What scripts do you need help with?
Offline
Infinite terrain basically requires a list that will get VERY long quite quickly OR a more clever method, the basics of which I'm still organizing in my head. The most basic way to generate terrain would be a "2D" array, in which you add to either the end or beginning depending on whether you're moving left or right (it's just 2D right?)
Offline
MoreGamesNow wrote:
Infinite terrain basically requires a list that will get VERY long quite quickly OR a more clever method, the basics of which I'm still organizing in my head. The most basic way to generate terrain would be a "2D" array, in which you add to either the end or beginning depending on whether you're moving left or right (it's just 2D right?)
I wonder who would make a 3D one. xD
Offline
Just 2D
i need help with spawning mobs
so at random a pig will apear or something
Offline
I'd personally be more concerned with mob AI. Spawning mobs should be a matter of picking a random x position and spawning it on the highest block of that x position.
I would personally store your list like this:
x1: (item 1, item 2, item 3, item 4, item 5)
x2: (item 6, item 7, item 8, item 9, item 10)
x3: (item 11, item 12, item 13, item 14, item 15)
x4: (item 16, item 17, item 18, item 19, item 20)
etc.
So that, to add land either to the left or to the right, it is only a matter of inserting at the beginning or adding at the end, rather than inserting items throughout your list.
Then, to see that the x and y position (on the grid, not on the screen) of the pig should be when spawned, choose a random x and, starting at the first item of the list of items, run through it.
Example:
set [spawn_x v] to (3) // random number set [y v] to (1) repeat until <(item ((spawn_x*height_of_grid)+(y)) of [grid v]) = ["empty"]> change [y v] by (1) endBTW, I'm assuming you're using a pseudo 2D list. The wiki article here describes a method similar to what I'm using, but I believe I am flipping the x and y around (hence "x*height" instead of "y*width").
Last edited by MoreGamesNow (2012-11-09 21:26:16)
Offline
*looks at your reply
What!?
what's the i variable for?
Offline
what are items?
i do not understand
Offline
i wish there was a way to make a
spawn new sprite block
Last edited by janderson01 (2012-11-09 18:05:30)
Offline
Sorry, I edited the post, it should make more sense now. Essentially, anytime you want to spawn a pig, you choose the x position ("spawn_x") and the above script should give you the y position (on the grid, not on the screen).
Offline
I think scratch won't be able to do what i want
i'll have to use greenfoot which is a java based step up from scratch
Offline
You could make a terrain that loops after you get a certain distance.
Offline