Heres a snippet of my scrolling code from an onClipEvent placed on the main character.
PHP Code:
} else {
if (!_root.bg.hitTest(_x-_global.barvar-(_width/2), _y-35, true) and (!_root.bg.hitTest(_x-_global.barvar-(_width/2), _y-40, true)) and (!_root.bg.hitTest(_x-_global.barvar-(_width/2), _y-30, true))) {
if(_root.bg._x <= _global.left_scroll and _root.watermelon_whole._x <= 160){
_root.fly._x -= _global.speed;
_root.bg3._x -= _global.speed;
_root.bg2._x -= (_global.speed /2);
_root.bg._x -= _global.speed;
_root.floater._x -= _global.speed;
_root.bg_block._x -= _global.speed;
_root.hornoad._x -= _global.speed;
_root.robo._x -= _global.speed;
_root.owtch._x -= _global.speed;
_root.waver._x -= _global.speed;
_root.reo._x -= _global.speed;
_root.sidehopper._x -= _global.speed;
_root.spires._x -= _global.speed;
_root.spirem._x -= _global.speed;
}else{
_root.watermelon_whole._x += _global.speed;
}
}
}
I also use hittesting for ceilings the same way for example
PHP Code:
if (_root.bg.hitTest(_x, _y-50, true)) {
_global.yvel = 10;
}
if (_root.bg.hitTest(_x+_global.barvar+(_width/2), _y-30, true)) {
_global.speed *= 0;
}
and so on. I tried looking and implementing tonypa's tile based stuff but i started from scratch and its a pain in the bum to understand. I like my clipevent coding because i can define stuff so much easier but i would also like to find a way to generate tiles but keep the coding on the main character. Any way to do so? Or is there more code needed?