Pixel Movement

by Forum_account
Pixel Movement
A pixel movement library for isometric and top-down maps.
ID:852352
 
i just can't get this code to work. i think it has something to do with the move proc. thank you in advanced

with this code in the move proc, i am trying to move the mobs to its initial loc when the mob is three tiles away from that initial position. the mob for brife second appears to be in two places at once. as if it is trying to go to the prosition but can't. any ideas as to what is causing that strange behavior?

        blue_ooze
base_state = "blue-ooze"
icon_state = "blue-ooze-standing"
shadow_state = "ooze-shadow"

power = 4
speed = 5
defense = 5

health = 40
max_health = 40

base_speed = 1

abilities = list(new /Ability/EnemyAttack())

var
tempx =0
tempy =0
tempz =0

New()
..()
money = rand(1, 10)
experience = 6

tempx = src.x
tempy = src.y
tempz = src.z


move()
..()
var/g = get_dist(loc,locate(tempx, tempy, tempz))
if(g > 3)
src.Move(locate(tempx, tempy, tempz))



Try putting that code in their ai() proc instead. You may also need to use the set_pos() proc instead of Move() to set the mob's position:

            ai()
var/turf/t = locate(tempx, tempy, tempz)
var/d = get_dist(loc, t)

if(d > 3)
set_pos(t.px, t.py)
else
..()
i have another move issue. i am using the move proc from pixel movement. i am trying to change to a different map using tags. runtime error: Cannot execute null.move(). i re-read the reference and could not find a proc to use in this example.
turf
sand
icon = 'icons/Sand.dmi'
stepped_on()
..()
usr.move(locate("dirt"))
Don't use usr in procs.
The stepped_on() proc takes a parameter that is the mob who is doing the stepping, you should use that instead. I'm also not sure what you're trying to accomplish with the move() proc there. The library's move() proc takes a direction as a parameter - when you press the up key, it calls move(NORTH). If you want to move the player to a location, you can just do something like this:

turf
sand
stepped_on(mob/m)
m.loc = locate("dirt")

And that syntax will only work if you've set a turf's tag to "dirt".
i should have figured this out myself. the problem was that i was using an item as a tag which was moving the mob to the black screen. i did not know i had to use a turf for a tag.

since the item tag did not work, i was trying to use Move proc to do it. i did not know that usr would be null it that case, so i tried your move proc. i should have read the the reference better. an overall bad experiment in programming but i still learned lots. :) thank you again