Entrar
Últimos assuntos
» Preciso de ajudapor AftonDuGrau Dom 21 Abr 2024, 20:18
» Como faz o evento drawn GUI, não se repetir?
por aminaro Sex 19 Abr 2024, 20:30
» Como ajustar velocidade de cada frame da animação no game maker
por Ralphed Qui 18 Abr 2024, 18:28
» PROBLEMAS COM FÍSICAS DE ÁGUA
por aminaro Ter 16 Abr 2024, 10:07
» Retorno da GMBR!!!
por Ralphed Sex 12 Abr 2024, 22:45
» JOGADOR PARANDO NO AR QUANDO ATACA
por aminaro Qua 10 Abr 2024, 13:51
» Problemas com texto interativo
por Kaaru72 Dom 07 Abr 2024, 11:31
» Erro escondido e indecifrável
por dev_gabize.azv Qui 04 Abr 2024, 10:11
» Mudar cor de apenas uma palavra
por Ralphed Sáb 30 Mar 2024, 00:39
» Procuro Programador de game maker
por Wou Sex 15 Mar 2024, 10:27
» Mod APK
por gamerainha Qua 13 Mar 2024, 06:30
» Aceito pedidos de sprites (Com exemplos meus)
por Sevilha Qua 28 Fev 2024, 12:17
» Inventário simples
por Isquilo_Roedor Qui 22 Fev 2024, 15:18
» Problemas na programaçnao de inimigo [jogo DOOM LIKE]
por Black Mirror Dom 11 Fev 2024, 13:34
» ANDROID MULTI TOUCH
por DiegoBr Dom 04 Fev 2024, 12:13
» Servidor de Discord do fórum?
por Lighter Sáb 27 Jan 2024, 17:18
» Save e Load Json
por Klinton Rodrigues Qui 25 Jan 2024, 11:12
» Colisão com mais de um objeto
por aminaro Seg 22 Jan 2024, 15:02
» Oi sou novo aqui
por Thiago Silveira Alexandre Sáb 20 Jan 2024, 20:55
» Como acessar conteudo comprado no marketplace
por macmilam Sex 19 Jan 2024, 07:42
» Devlogs em vídeos do Block Room
por Joton Seg 15 Jan 2024, 16:56
» Alguém aqui já ganha dinheiro com seus games?
por Joton Seg 15 Jan 2024, 16:49
» ACERVO GMBR MAGAZINE
por Joton Qui 11 Jan 2024, 19:21
» como aumentar o obj sem aumentar a colisão??
por GabrielXavier Qua 10 Jan 2024, 07:21
» Asteroid Core - Early Acesse Update [0.2.0.0]
por JOZ. Seg 08 Jan 2024, 14:39
[Duvida]zoom android
2 participantes
Página 1 de 1
[Duvida]zoom android
Baixei um script de zoom pra android, e pra minha surpresa ele funciona
mais nem td são flores parece incompleto, {gostaria que o zoom sempre foce realizado no meio da tela, que o limite máximo foce de 3x e limite minimo foce do tamanho real da imagem, é um belo problema matemático} alguem??
Create()
Glob left button()
mais nem td são flores parece incompleto, {gostaria que o zoom sempre foce realizado no meio da tela, que o limite máximo foce de 3x e limite minimo foce do tamanho real da imagem, é um belo problema matemático} alguem??
Create()
- Código:
initial_w_view = view_wview[0];
view_scale = 1;
global.minzoom = 0.1;
initial_x = 0;
initial_y = 0;
initial_zoom = 0;
Glob left button()
- Código:
var view_ratio;
view_ratio = view_hview[0]/view_wview[0];
if( device_mouse_check_button_pressed( 1, mb_left ) )
{
initial_x = mean( device_mouse_x( 0 ), device_mouse_x( 1 ) );
initial_y = mean( device_mouse_y( 0 ), device_mouse_y( 1 ) );
initial_zoom =
point_distance
(
device_mouse_raw_x( 0 ), device_mouse_raw_y( 0 ),
device_mouse_raw_x( 1 ), device_mouse_raw_y( 1 )
)*view_scale;
};
if( device_mouse_check_button( 1, mb_left ) )
{
view_scale = initial_zoom/
point_distance
(
device_mouse_raw_x( 0 ), device_mouse_raw_y( 0 ),
device_mouse_raw_x( 1 ), device_mouse_raw_y( 1 )
);
view_wview[0] = initial_w_view*clamp(view_scale, global.minzoom, 10);
view_hview[0] = view_wview[0]*view_ratio;
view_xview[0] += initial_x-mean( device_mouse_x( 0 ), device_mouse_x( 1 ) );
view_yview[0] += initial_y-mean( device_mouse_y( 0 ), device_mouse_y( 1 ) );
};
Gonzo- Data de inscrição : 29/05/2012
Reputação : 33
Número de Mensagens : 929
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: [Duvida]zoom android
Sério, gente me ajudem só falta isso pra terminar meu jogo não consigo fazer um zoom perfeito alguém pode me ajudar, prometo que fico 3 meses sem pedir nd aqui no forum uahuahuha beijo do Gonzo
Última edição por Gonzo em Dom 28 Set 2014, 00:46, editado 1 vez(es)
Gonzo- Data de inscrição : 29/05/2012
Reputação : 33
Número de Mensagens : 929
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: [Duvida]zoom android
Pegue o valor do aumento de view_w/hview divida pela metade e subtraia em view_x/yview.
Re: [Duvida]zoom android
Baseado no que eu preciso alguem poderia criar esse sistema de uma forma mais limpa? agradeço desde já
Gonzo- Data de inscrição : 29/05/2012
Reputação : 33
Número de Mensagens : 929
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: [Duvida]zoom android
Achei finalmente um script bacana uhauah
em create event() cole o code
{
initial_x = 0;
initial_y = 0;
initial_w = view_wview[0];
initial_h = view_hview[0];
initial_zoom = 0;
view_scale = 1;
}
em step event cole o code()
var mx0, my0, mx1, my1, mx0raw, my0raw, mx1raw, my1raw;
mx0 = device_mouse_x(0); my0 = device_mouse_y(0);
mx1 = device_mouse_x(1); my1 = device_mouse_y(1)
mx0raw = device_mouse_raw_x(0); my0raw = device_mouse_raw_y(0)
mx1raw = device_mouse_raw_x(1); my1raw = device_mouse_raw_y(1)
if ( device_mouse_check_button_pressed(1, mb_left) )
{initial_x = mean(mx0, mx1);initial_y = mean(my0, my1);
initial_zoom = point_distance(mx0raw, my0raw, mx1raw ,my1raw) * view_scale
}
if ( device_mouse_check_button(1, mb_left) )
{
view_scale = initial_zoom / point_distance(mx0raw, my0raw, mx1raw, my1raw);
if (view_scale > 1) view_scale = 1;
view_wview[0] = initial_w * view_scale;
view_hview[0] = initial_h * view_scale
view_xview[0] += initial_x - mean(mx0, mx1)
view_yview[0] += initial_y - mean(my0, my1)
if (view_xview[0] < 0) view_xview[0] = 0
if (view_xview[0] + view_wview[0] > room_width)
view_xview[0] = room_width - view_wview[0]
if (view_yview[0] < 0) view_yview[0] = 0
if (view_yview[0] + view_hview[0] > room_height)
view_yview[0] = room_height - view_hview[0]
}
A duvida agora é..
como ampliar com menos velocidade sem tremer tanto e colocar um limite para o zoom, fico no aguardo obrigado.
em create event() cole o code
{
initial_x = 0;
initial_y = 0;
initial_w = view_wview[0];
initial_h = view_hview[0];
initial_zoom = 0;
view_scale = 1;
}
em step event cole o code()
var mx0, my0, mx1, my1, mx0raw, my0raw, mx1raw, my1raw;
mx0 = device_mouse_x(0); my0 = device_mouse_y(0);
mx1 = device_mouse_x(1); my1 = device_mouse_y(1)
mx0raw = device_mouse_raw_x(0); my0raw = device_mouse_raw_y(0)
mx1raw = device_mouse_raw_x(1); my1raw = device_mouse_raw_y(1)
if ( device_mouse_check_button_pressed(1, mb_left) )
{initial_x = mean(mx0, mx1);initial_y = mean(my0, my1);
initial_zoom = point_distance(mx0raw, my0raw, mx1raw ,my1raw) * view_scale
}
if ( device_mouse_check_button(1, mb_left) )
{
view_scale = initial_zoom / point_distance(mx0raw, my0raw, mx1raw, my1raw);
if (view_scale > 1) view_scale = 1;
view_wview[0] = initial_w * view_scale;
view_hview[0] = initial_h * view_scale
view_xview[0] += initial_x - mean(mx0, mx1)
view_yview[0] += initial_y - mean(my0, my1)
if (view_xview[0] < 0) view_xview[0] = 0
if (view_xview[0] + view_wview[0] > room_width)
view_xview[0] = room_width - view_wview[0]
if (view_yview[0] < 0) view_yview[0] = 0
if (view_yview[0] + view_hview[0] > room_height)
view_yview[0] = room_height - view_hview[0]
}
A duvida agora é..
como ampliar com menos velocidade sem tremer tanto e colocar um limite para o zoom, fico no aguardo obrigado.
Gonzo- Data de inscrição : 29/05/2012
Reputação : 33
Número de Mensagens : 929
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Tópicos semelhantes
» dúvida com zoom
» [Duvida] zoom em obj especifico
» [Duvida] sdk android
» [Duvida] Zoom só na area selecionada - GMS
» [Duvida] A procura do zoom padrão
» [Duvida] zoom em obj especifico
» [Duvida] sdk android
» [Duvida] Zoom só na area selecionada - GMS
» [Duvida] A procura do zoom padrão
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|