Forum

> > CS2D > Scripts > Image Move
Forums overviewCS2D overview Scripts overviewLog in to reply

English Image Move

12 replies
To the start Previous 1 Next To the start

old Image Move

kalis
User Off Offline

Quote
Hey all ^^! i try to make monster lua.
who know the code
+my monster only move in tile "walkable" , not in "wall"
+And how make it dont go near wall ?
i saw in tibia
i had local x
1
x = x*32+16

old Re: Image Move

Starkkz
Moderator Off Offline

Quote
You mean you want to make monsters that move through the walls for tibia?

old Re: Image Move

Apache uwu
User Off Offline

Quote
Can I see a snippet? It's not exactly possible to see where you went wrong.

old Re: Image Move

kalis
User Off Offline

Quote
lol
i mean i want code like :
1
2
x = x*32+16
y = y*32+16
x = my moneyter "x"
y = my monster "y"
need math.sin,math.cos ?

old Re: Image Move

Apache uwu
User Off Offline

Quote
Ah so you want your monster to go in a direction for a certain speed.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
monster={}
monster.x=0
monster.y=0

monster.x,monster.y=move_towards(monster,90,32)[1],move_towards(90)[2]

print(monster.x.." "..monster.y)

function move_towards(array,angle,speed)
	if angle < -90 then
		angle=angle+360
	end
	angle_to=math.rad(math.abs(angle + 90))-math.pi
	t_temp={array.x+math.cos(angle_to)*speed,array.x+math.sin(angle_to)*speed}
	return t_temp
end

Haven't tested, use your math skills to figure it out.

old Re: Image Move

kalis
User Off Offline

Quote
thank i going to test it
hey ,you can recieve my message ? i will send you full lua

old Re: Image Move

Deleted User

Quote
1
2
monstertilex = math.floor(monsterx / 32)
monstertiley = math.floor(monstery / 32)

old Re: Image Move

kalis
User Off Offline

Quote
@Factis699 thank,it work but my monster still stay a place =.= , it dont move more
1
2
3
4
.
x = x*32+16 then 

Monster x = x

old Re: Image Move

Starkkz
Moderator Off Offline

Quote
Is not that just set the value, you have to use the imagepos function to see if it moves.

old Re: Image Move

kalis
User Off Offline

Quote
i have use imagepos for monster !
i saw monster !
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview