Tilemaps can have two objects placed on it, 'p_foreground' and 'p_vanishing' whose placement form a virtual perspective plane, which causes sprites to scale as they move up and down the screen between them, creating the illusion of depth on the screen
This commit is contained in:
@@ -254,8 +254,8 @@ akerr_ErrorContext *akgl_actor_render(akgl_Actor *obj, SDL_Renderer *renderer)
|
||||
dest.x = (obj->x - camera.x);
|
||||
dest.y = (obj->y - camera.y);
|
||||
}
|
||||
dest.w = curSprite->width;
|
||||
dest.h = curSprite->width;
|
||||
dest.w = curSprite->width * obj->scale;
|
||||
dest.h = curSprite->width * obj->scale;
|
||||
|
||||
SDL_RenderTexture(renderer, curSprite->sheet->texture, &src, &dest);
|
||||
SUCCEED_RETURN(errctx);
|
||||
@@ -300,6 +300,11 @@ void akgl_registry_iterate_actor(void *userdata, SDL_PropertiesID registry, cons
|
||||
if ( AKGL_BITMASK_HAS(opflags->flags, AKGL_ITERATOR_OP_UPDATE) ) {
|
||||
CATCH(errctx, obj->updatefunc(obj));
|
||||
}
|
||||
if ( AKGL_BITMASK_HAS(opflags->flags, AKGL_ITERATOR_OP_TILEMAPSCALE) ) {
|
||||
CATCH(errctx, akgl_tilemap_scale_actor(&gamemap, obj));
|
||||
} else {
|
||||
obj->scale = 1.0;
|
||||
}
|
||||
if ( AKGL_BITMASK_HAS(opflags->flags, AKGL_ITERATOR_OP_RENDER) ) {
|
||||
CATCH(errctx, obj->renderfunc(obj, renderer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user