Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Help Request: How to Draw in relation to a view?  (Read 1278 times)

0 Members and 1 Guest are viewing this topic.

Dark-Hylian

Silence
Help Request: How to Draw in relation to a view?
« on: January 22, 2010, 10:06:11 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Anyone know how to draw in relation to a view? I've tried the view_x( and view_y( that used to work in GM7, but GM8 doesn't recognize it.

What it's being used in:

Drawing a heart sprite this far apart from the edge of the view.

View's dimensions: 320 by 240

Anyone have any idea?

EDIT:

Figured it out. Locking Topic?
« Last Edit: January 22, 2010, 11:13:41 pm by Dark-Hylian »
Logged
  • Dawning Hour
Re: Help Request: How to Draw in relation to a v...
« Reply #1 on: January 22, 2010, 11:17:03 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
It's as simple as:
Code: [Select]
draw_sprite(sprite,image_index,view_xview[#] + #,view_yview[#] + #);

And of course replace the #'s with their appropriate values. And you'll most likely be using 0 for your view_xview[], and view_yview[] arrays.
Logged
  • https://colbydude.com

Dark-Hylian

Silence
Re: Help Request: How to Draw in relation to a v...
« Reply #2 on: February 23, 2010, 03:08:47 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
NOT gravedigging, my post! Anyways, it was working, the whole drawing my HUD stuff, but when it came to the pause menu, some anomolies occured. Okay, when I drew it, at view_xview[0]-40 and view_yview[0]-40 (putting it at the top left, so it covered the whole screen), the 320 by 240 view was totally eclipsed, as planned. However, when you get near an edge of the room, and the view shifts, it draws it differently, as in:

(Note, the ZFGC CP Project background has been given credit for, and is temporarily a placeholder!!)

Anyways, the view is 320 by 240, as is the sprite. The view is 320 by 240 port, and 9999 H and Vborder, as well as -1H and Vsp. It's centered around link, and seems to adjust so as well. I figure it's something to do with the object going over the edge of the screen or something...

Anyone know what's wrong?
Logged
  • Dawning Hour
Re: Help Request: How to Draw in relation to a v...
« Reply #3 on: February 23, 2010, 05:31:47 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
don't set your h and v borders to 9999 for a start. make them half the view size, ie 160 by 120, otherwise that can cause a number of problems.
Make sure your draw event is where the menu drawing is happening. Prefferably in a dummy object that can be removed when closing the menu.
why are you drawing at -40 from the view? you should be able to put it right at view_xview and view_yview if it's a 320x240 sprite.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Help Request: How to Draw in relation to a v...
« Reply #4 on: February 23, 2010, 08:49:27 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Okay, when I drew it, at view_xview[0]-40 and view_yview[0]-40 (putting it at the top left, so it covered the whole screen), the 320 by 240 view was totally eclipsed, as planned.
I have to agree with DL. Painting at view_xview and view_yview should be enough. Additionally 40 is a really odd number, as I assume the rest of your grid is 16x16.

However, when you get near an edge of the room, and the view shifts, it draws it differently, as in:
Considering the abrupt ending I assume that we had to take a look at the screens here.

Anyways, the view is 320 by 240, as is the sprite. The view is 320 by 240 port, and 9999 H and Vborder, as well as -1H and Vsp. It's centered around link, and seems to adjust so as well. I figure it's something to do with the object going over the edge of the screen or something...
A lot off settings, where half of them I don't know what they are for. But I suggest using default settings.

Well it seems more that you draw the menu in relation to Link instead of the view. But it could also be that you do not update your view correct and thus have the view and viewport disconnected. As the view continues to follow Link where the viewport stops at the edge of the room. You could use view_xport and view_yport instead of view_xview and view_yview. Either way take a good look at your view update code.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.32 seconds with 45 queries.