Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1028082 Posts in 41266 Topics- by 32884 Members - Latest Member: schwa

July 30, 2014, 05:08:13 AM
TIGSource ForumsDeveloperTutorialsQuestion Regarding view_Xview and view_yview
Pages: [1]
Print
Author Topic: Question Regarding view_Xview and view_yview  (Read 869 times)
PogueSquadron
Level 0
***



View Profile WWW
« on: November 28, 2012, 10:30:52 PM »

Question from a noobie, and it's really just about how Game Maker forces you to write things in certain ways. I'm just working my way through a tutorial so hopefully you don't mind if I throw this question out there.

Let's say I have destroyed all of the enemies on the screen, and I would like a couple more to pop up once they are all gone. Something simple like this would be in my code:

if (not instance_exists(oEnemyBlue))
{
    instance_create(view_xview[0]+596, view_yview[0]+96, oEnemyBlue);
    instance_create(view_xview[0]+300, view_yview[0]+200, oEnemyBlue);
}   



My question is regarding the view_xview[0]+596 portion of the code. Why can't I just say the following?


view_xview 596


Why is the
  • +insertnumberhere[/i] necessary when creating an instance at a particular set of coordinates? Maybe this is silly, but if 0+596= 596, why is the extra part necessary? It's just confusing because I'm trying to learn when to add parentheses, brackets, etc., and it's a little more complicated when I have to also know when I can have numbers, and when I have to add them (to zero?).

    Thanks! I'm having a lot of fun with all of this.
Logged
vinheim3
Level 4
****


vinheim3
View Profile Email
« Reply #1 on: November 29, 2012, 01:09:36 AM »

view_xview[0] refers to the 1st view, or the view you're currently using
view_xview[1] is then the second view, etc

So view_xview[0]+596 isn't the same as view_xview[596], it's simply saying: 596 pixels right of where the 1st view starts
Logged
PogueSquadron
Level 0
***



View Profile WWW
« Reply #2 on: November 29, 2012, 02:06:42 PM »

Oh, I see, thanks! It really helps to know what everything means, because I want to be able to learn how to make certain lines of code on my own. Sometimes these tutorials will tell you what a chunk of code means on the whole, but may not explain each individual phrase.

Edit: Sorry for posting this in a new thread. I should've posted it in the tutorial thread. Please feel free to delete!
« Last Edit: November 30, 2012, 01:26:04 PM by PogueSquadron » Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic