Jump to content


Photo

If object in view code


  • Please log in to reply
2 replies to this topic

#1 Devilfromhost12

Devilfromhost12

    GMC Member

  • GMC Member
  • 735 posts

Posted 26 February 2012 - 03:21 AM

So I'll have this object called obj_enemy_parent that parents ever enemy. I want it to where if obj_enemy_parent is in view 1, it sets a variable called in_view to true. How would I do that. Or where if obj_enemy_parent is in view 1 it does alarm0=150. Either way it would be like the same thing. :P But how would I do that.

-Thank you for your help-
  • 0

#2 FoxInABox

FoxInABox

    GMC Member

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

Posted 26 February 2012 - 03:54 AM

pretty close to this
in_view = x>view_xview[1] && x<view_xview[1]+view_wview[1] &&

          y>view_yview[1] && y<view_yview[1]+view_hview[1];



if in_view // inside view

  if alarm[0]<0 // if the alarm is off

    alarm[0]=150;

  • 0

#3 Devilfromhost12

Devilfromhost12

    GMC Member

  • GMC Member
  • 735 posts

Posted 26 February 2012 - 04:17 AM

pretty close to this

in_view = x>view_xview[1] && x<view_xview[1]+view_wview[1] &&
          y>view_yview[1] && y<view_yview[1]+view_hview[1];

if in_view // inside view
  if alarm[0]<0 // if the alarm is off
    alarm[0]=150;


So would that be like in the obj_enemy_parent create code?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users