Jump to content


Photo

RTS array rules


  • Please log in to reply
6 replies to this topic

#1 _259230

_259230

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 April 2012 - 06:35 AM

hi everybody,
I have a complicated problem here to making game RTS ....
I want use right click to choose which object that I will move to some place
I'd make a code but it still not working... here it is...
if mouse_check_button(mb_right) and colouring = 0 {
   colouring = 1;
   }  
if mouse_check_button(mb_right) and colouring = 1 {
   colouring = 0;
   }
if someone can help me, I will appreciate that !!.....
  • 0

#2 integrate

integrate

    GMC Member

  • GMC Member
  • 255 posts
  • Version:GM8

Posted 28 April 2012 - 06:52 AM

hi everybody,
I have a complicated problem here to making game RTS ....
I want use right click to choose which object that I will move to some place
I'd make a code but it still not working... here it is...

if mouse_check_button(mb_right) and colouring = 0 {
   colouring = 1;
   }  
if mouse_check_button(mb_right) and colouring = 1 {
   colouring = 0;
   }
if someone can help me, I will appreciate that !!.....


What about this piece of code isn't working?
  • 0

#3 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8246 posts
  • Version:GM7

Posted 28 April 2012 - 06:56 AM

Don't look at it as a block of code, look at it line by line, then you'll catch the error.

You're basically changing colouring to 1, and since the next line checks if that variable is set to 1, it goes back to 0. Even if the code was correct, you should check to see if the button pressed as opposed to being down, otherwise it will change every step.

if (mouse_check_button_pressed(mb_right)) colouring = !colouring;

  • 0

#4 _259230

_259230

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 April 2012 - 07:04 AM

Don't look at it as a block of code, look at it line by line, then you'll catch the error.

You're basically changing colouring to 1, and since the next line checks if that variable is set to 1, it goes back to 0. Even if the code was correct, you should check to see if the button pressed as opposed to being down, otherwise it will change every step.

if (mouse_check_button_pressed(mb_right)) colouring = !colouring;

thx very much !!! how did u know ?? you're really genious battlerifle really special thx to you  :biggrin:
  • 0

#5 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8246 posts
  • Version:GM7

Posted 28 April 2012 - 07:05 AM

Logic, my friend.
  • 0

#6 integrate

integrate

    GMC Member

  • GMC Member
  • 255 posts
  • Version:GM8

Posted 28 April 2012 - 07:07 AM

Logic, my friend.

touche!
  • 0

#7 _259230

_259230

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 April 2012 - 07:21 AM

One more my friend,
I want to choose object only if my mouse collides with the nearest object,,
coz, when I click right button all of my object is choosed !!
what's the solution for it ??
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users