Quote: "Hopefully they'll be adding in the ability to change UV coords on objects soon"
If you use a shader, i think you should do that.
For example :
Shader.vs :
attribute vec3 position;
attribute vec2 uv;
uniform vec2 Move;
varying vec2 uvVarying;
varying vec3 posVarying;
uniform mat4 agk_World;
uniform mat4 agk_ViewProj;
uniform vec4 uvBounds0;
void main()
{
vec4 pos = agk_World * vec4(position,1.0);
gl_Position = agk_ViewProj * pos;
posVarying = position.xyz;
uvVarying.x = (uv.x * uvBounds0.x + Move.x) + (uvBounds0.z);
uvVarying.y = (uv.y * uvBounds0.y + Move.y) + (uvBounds0.w);
}
Shader.ps :
uniform sampler2D texture0;
uniform vec4 agk_MeshDiffuse;
varying vec2 uvVarying;
void main()
{
gl_FragColor = (texture2D(texture0, uvVarying) * agk_MeshDiffuse);
}
And you change in your code the shader with :
SetShaderConstantByName(2,"Move",a#,b#,1.0,1.0)
If your spritesheet is (256*256) (16 frames of 64*64), so a# and b# = 1/4 by frame.
frame 1 : SetShaderConstantByName(2,"Move",0,0,1.0,1.0)
frame 2 : SetShaderConstantByName(2,"Move",0.25,0,1.0,1.0)
frame 3 : SetShaderConstantByName(2,"Move",0.5,0,1.0,1.0)
And so
I think this operation should work (not tested ^^)
- a#=mod(frame,4)*0.25
- b#= 0.25*abs(frame/4).
AGK2 tier1 - http://www.dracaena-studio.com