by 247wkman » Sun Aug 04, 2013 11:51 pm
(after many edits)
I GOT THE ZOOM TO WORK FOR A FULLY ANIMATED ACTOR NOW!
the trick is to make a reference to what value you want zoom to represent at each event like this:
in canvas; create event:
zoom=1; //enables the actor's first draw to be true size (or desired size)
erase(0, 0, 0, 1);
draw_from("blow", 320, 228, zoom);
draw event:
erase(0, 0, 0, 1);
draw_from("blow", 320, 228, zoom); // draw will refresh the actor frames so it can maintain continuos animation and specifically, zoom at its LAST referenced value. because zoom has a value reference at 'create event', the actor no longer starts of as the -so small it dosent even exist size, it has a scale of origin now.
add some left/right movement to the canvas (or i guess you could do a left/right-/+=# in the canvas draw code i think- if zoom is anything to go by) and you have a character that can move in 4 or even 8 directions (set a diagonal movement up and half the value change of zoom) moving towards and away from the view.
i set a collision event with the earth so see how it responds (okay i think). using scale up to collide with it, pushes the canvas away and reveals the boundry.
which leads to the next problem: how do i limet the scalling of the sprite? by adding a constraint after the zoom value statement:
in the down key event after: ''zoom+=0.01;'' add: ''if (zoom>2) zoom=2;'' // 2 will keep it from getting larger than twice its size.
in the up key event after: ''zoom-=0.01;'' add: ''if (zoom<0.3) zoom=0.3;'' // if you wonder why i set up to shrink and down to grow; its because i'm thinking in terms of moving a player actor to and from the camera!
additional tweak: distance percieved speed
something bothers me- the actor shrinks faster as it gets smaller and grows slower as it gits bigger. maybe its like when a tablet when its desolving in water. but if your in a car passing pylons/road lamps, you find distant things move towards/away slowly and then as they get closer they speed up and zip passed you; so with this in mind i make this change in the ''up key'' action: zoom-=zoom*0.02;
and ''down key'' action: zoom+=zoom*0.02;
it should multiply zoom by small value; so each multiplication should be larger than the previous one, and if the result is smaller each time then it will shrink slower. (the ''if'' stuff is not relevant here, just playing with the values)
deal with collision into a wall when moving up/down screen? how to create an assotiation between it and z-depth and y position of foot contact to the ground (so that if you move up to a wall, the feet will be level with the base of it when you bump into it- it would be ideal to have a separate actor to sit at the foot of the player as the basis of depth set obsticals. but how to keep it there when the scale of origin is at the centre of the actor... i could double the height of the sprite image- so the charcters feet begin at the halfway point. then can set the draw coordinates to the center of the canvas. the parant/ground collider actor sitting a the feet should remain as such- this would save me figureing out a code that would require refrencing zoom's value [as zoom now has a create size, its size after being scaled up/down is probably attainable somehow now] and telling the grounding actor to move up/down from the canvas center at some given formula- but wouldn't this save more memory than doubling the height of an image sequence?)
- Attachments
-
- zoom.character test.rar
- (253.74 KiB) Downloaded 147 times