|
I would not like to dishearten you, but things might not be as simple as you might have thought.
I presume that you want your "pixel" (by the way, where is he? ) should move inside your "arena". If so, there might be several steps to pass:
1. Build you arena (by the way, I see no reason for building it using javascript)
2. Return the arena 'limits";
3. Set the move function (by the way, which might be the event to start/stop moving process?)
3. If "pixel" position is to excede the arena limits, keep it inside (change move direction or stop)
Note: you must see the arena and the "pixel" as two distinct objects, thus you must positioned them in the document (CSS and then CSS on-the-fly for moving action)
|