Default coding:
turf/tiles/green/Click(obj/pieces/red/r, obj/pieces/blue/b) if(usr.player!=turn) return if(!usr.hold) return if(get_dist(usr.hold,src)>1) return if((usr.player && usr.hold.y>src.y) | (!usr.player && usr.hold.y<src.y)) return else if(usr.hold && !usr.mustjump && get_dist(usr.hold,src)>0) usr.hold.Move(src) turn=!turn world << "Global Turn is [turn]" else if(usr.hold && usr.mustjump) usr << "You must jump!"
|
Edited coding (coding I tried messing with to get results):
turf/tiles/green/Click(obj/pieces/red/r, obj/pieces/blue/b) if(usr.player!=turn) return if(!usr.hold) return if(usr.player) for(b in get_step(usr.hold,get_dir(usr.hold,src))) if(get_dist(usr.hold,src)==1) return if(get_dist(usr.hold,src)>1) for(var/obj/pieces/p in get_step(usr.hold,get_dir(usr.hold,src))) del p usr.hold.Move(src) turn=!turn usr.mustjump=1 for(var/obj/pieces/p in oview(1,/obj/pieces/red)) if(istype(p,/obj/pieces/red)) world << "You must jump" return if((usr.player && usr.hold.y>src.y) | (!usr.player && usr.hold.y<src.y)) return else if(usr.hold && !usr.mustjump && get_dist(usr.hold,src)>0) usr.hold.Move(src) turn=!turn world << "Global Turn is [turn]" else if(usr.hold && usr.mustjump) usr << "You must jump!"
|
Problem description: I am making a checkers game for DM practice. But I am stuck here! I am trying to do these:
1)Make it so my piece jumps over enemy pieces
2)Make it so my piece must jump over other piece when its time. Alert and cancel out any other jump.
3)Make so it won't jump 2 tiles in another direction
4)When locked pieces at the end of both sides, you can move
5)If pieces block the jump, the piece can move elsewhere
But I can't figure out how to do it. For one thing I can't figure out how to separate each individual pieces. If I wanted to make it so when 2 pieces are near each other to make the piece jump over another, I don't know how to do it.
Note: the above isn't intended to be used, it wont work. It is only meant to show an example to what I am talking about.