Forum

> > CS2D > Scripts > [Q] Spawn blocks
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Q] Spawn blocks

5 replies
To the start Previous 1 Next To the start

old [Q] Spawn blocks

Iamle0
User Off Offline

Quote
Hey guys. Sorry me but i'm realy noob in lua.

How to spawn/create Env_Breakable using lua? So that's the question. If you know, then please write code.

old Re: [Q] Spawn blocks

Heartless Soldier
User Off Offline

Quote
user Apache uwu has written
A better solution would be to spawn walls, and place images over them.


ye, or make imaginary blocks. You can have a dictionary to save the "old" player position (x and y) and a table of two dimentions to save the blocks positions. With the tilemove hook you can know if the player moved to another tile, so you check if there isn't any block in that tile (i.e.: if block[newx][newy] ~= nil...), otherwise it sends the player to his/her last position (i.e.: parse("setpos "..id.." "..playerpos[id].oldx.." "..playerpos[id].oldy)). Then you just could add the blocks like block[X][Y] = true, and place an image over there if you want.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview