Old experiment: pan through an image with actionscript
Talking about Flash.
Learn cross platform HTML5 game development
Check my Gumroad page for commented source code, games and books.
This is an experiment made in 2004 translated into a newer version of actionscript.
It’s very simple and needs a lot of improvements and I think you could transform this file into something usable.
The actionscript, all in the first frame, is very simple: the two objects are the_arrow representing the mouse pointer and map representing the image.
Mouse.hide();
_root.attachMovie("map", "map", 1);
_root.attachMovie("the_arrow", "the_arrow", 2, {_x:250, _y:175});
the_arrow.onEnterFrame = function() {
this._x += (_xmouse-this._x)/5;
this._y += (_ymouse-this._y)/5;
dist_x = this._x-250;
dist_y = this._y-175;
angle = Math.atan(dist_y/dist_x)/(Math.PI/180);
if (dist_x<0) {
angle += 180;
}
if (dist_x>=0 and dist_y<0) {
angle += 360;
}
this._rotation = angle;
deltax = -(this._x-250)/90;
deltay = -(this._y-175)/90;
map._x += deltax;
map._y += deltay;
if (map._x>1000) {
map._x = 1000;
}
if (map._x<-500) {
map._x = -500;
}
if (map._y>1000) {
map._x = 1000;
}
if (map._y<-650) {
map._y = -650;
}
};
Being an old experiment, I won't comment it, but someday I am going to release a newer, released version.
Here it is the source code for you to enjoy.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.