Jump to content


Photo

is there an example on how to have a view zoom out


  • Please log in to reply
6 replies to this topic

#1 Monolisk

Monolisk

    GMC Member

  • GMC Member
  • 62 posts
  • Version:GM:Studio

Posted 30 January 2012 - 10:36 PM

I am having alot of trouble doing this on my own, I am using 2 views and scaling one of them but my "hud view" still draws the background and and all of the objects in the orom, is there a way that I can make it only display what is in my draw event for that view? any help is much appreciated!!
  • 0

#2 andressmithuis

andressmithuis

    GMC Member

  • New Member
  • 82 posts
  • Version:GM8

Posted 30 January 2012 - 10:43 PM

I think youll have to draw separate sprites for that one. It's my way of making a 'radar' in my games.
for example i use this in my obj_radar:

with(obj_enemy)
{
 draw_circle_color((x/100)+view_xview,(y/100)+view_yview,2,c_red,c_red)
}

This draws a red dot as an enemy in the top left corner of my view. You could replace the 'draw_circle' with 'draw_sprite' to see actual sprites instead of a red dot.

Hope this helps!:smile:

EDIT: you should use one view for this though...

Edited by andressmithuis, 30 January 2012 - 10:44 PM.

  • 0

#3 Monolisk

Monolisk

    GMC Member

  • GMC Member
  • 62 posts
  • Version:GM:Studio

Posted 30 January 2012 - 10:51 PM

what I am trying to accomplish is simply having health bars and sprites being drawn in such a way so that they themselves do not appear to scale at all as the view zooms out or back in. I tried using that bit u posted but it still scaled them although a little better. I was thinking using 2 different views and only scaling one of them would be the best way but unfortunately I cant figure out how to draw only those HUD health bars and sprites in the view that doesn't scale. it wants to draw everything =/

EDIT: here is a demo of the game, so you guys can see what I mean with the zooming. Mouse wheel to zoom in/out (info has controls)
It's 11.32 MB tho sry lol havent started optimizing graphics yet: Zoomtest

Edited by Monolisk, 30 January 2012 - 10:59 PM.

  • 0

#4 andressmithuis

andressmithuis

    GMC Member

  • New Member
  • 82 posts
  • Version:GM8

Posted 30 January 2012 - 11:02 PM

what I am trying to accomplish is simply having health bars and sprites being drawn in such a way so that they themselves do not appear to scale at all as the view zooms out or back in. I tried using that bit u posted but it still scaled them although a little better. I was thinking using 2 different views and only scaling one of them would be the best way but unfortunately I cant figure out how to draw only those HUD health bars and sprites in the view that doesn't scale. it wants to draw everything =/


okay slightly misunderstood u then, srry for that :tongue:

okay on to the next problem... maybe when you draw your healthbar etc, you can use your 'zoom amount' in your sprite scale? (or draw scale for that matter). may sound confusing, ill try to explain:

in a normal view(not zoomed) how big is your sprite or drawed healthbar? say it is like half of your view width and 1/10 of your view height. you can draw it scaled using the view_wview and view_hview!

example:

draw_healthbar(view_xview,view_yview,view_xview+(0.5*view_wview),view_yview+(0.1*view_hview),etc.

is this what your after?

EDIT: game looks awsome btw! maybe you could teach me how to create that motion blur effect if you like? :biggrin:

EDIT 2: made a simple game in GM with the zooming option, i got it working with the above method;)

Edited by andressmithuis, 31 January 2012 - 01:54 PM.

  • 0

#5 Monolisk

Monolisk

    GMC Member

  • GMC Member
  • 62 posts
  • Version:GM:Studio

Posted 31 January 2012 - 12:11 AM

You are a life saver man!! That is precisely what I needed done!! Thank you thank you thank you!!

My motion blur effect comes from a partical effect I found thru google-ing game maker examples, here is the code (GM:Html5)

Create Event:
ps=part_system_create();//creates a new particle system
em=part_emitter_create(ps);//creates a new particle emitter

part_emitter_region(ps,em,x,x,y,y,ps_shape_line,ps_distr_linear);//sets the emitters region to the x and y positions

bl=part_type_create();//creates a new particle type
part_type_alpha2(bl,0.25,0);//sets the alpha of the new particle
part_type_life(bl,10,10);//sets the life of the new particle

Step Event:
part_emitter_region(ps,em,x,x,y,y,ps_shape_line,ps_distr_linear);//sets the emitters region to the x and y positions
part_type_color1(bl,image_blend);//changes the particles color
part_type_orientation(bl,image_angle,image_angle,0,0,0);//rotates the particles to your direction
part_type_scale(bl,image_xscale,image_yscale);//changes the particles scale
part_type_sprite(bl,sprite_index,false,false,false);//sets the sprite of the new particle

if speed>=12 part_emitter_burst(ps,em,bl,1);//creates one particle each step

  • 0

#6 Monolisk

Monolisk

    GMC Member

  • GMC Member
  • 62 posts
  • Version:GM:Studio

Posted 31 January 2012 - 04:50 AM

is there a way to do this with sprites too? i got my HUD bars working perfect thanks to u but i am going to have a pause button and a virtual key also to replace the mouse shooting for the mobile version. I cant get it to work with sprites tho

EDIT: check out the new version here feel free to give constructive criticism or comments!!!

Edited by Monolisk, 31 January 2012 - 05:15 AM.

  • 0

#7 andressmithuis

andressmithuis

    GMC Member

  • New Member
  • 82 posts
  • Version:GM8

Posted 31 January 2012 - 01:40 PM

is there a way to do this with sprites too? i got my HUD bars working perfect thanks to u but i am going to have a pause button and a virtual key also to replace the mouse shooting for the mobile version. I cant get it to work with sprites tho

EDIT: check out the new version here feel free to give constructive criticism or comments!!!


with sprites its just the same thing i guess. Let me try:

draw_sprite_ext(<sprite>,<subimg>,view_xview,view_yview,0.25*view_wview,0.1*view_hview,<direction>,c_white,1)

this will work fine IF you place the origin of the sprite at 0,0 (left top).

Hope this also helps, im glad i could help you earlier. Ill try your new version in a moment;)

EDIT: works like a charm;) only thing i could come up with as some tips is that it might be nice if you can shoot towards the mouse(I think you were planning on doing this anyway:P). and some enemies are drawn above the status bars. Other than that, beautifull game. Graphics looks awsome! ;)

Edited by andressmithuis, 31 January 2012 - 01:47 PM.

  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users