Jump to content


Photo

smart code for arrays


  • Please log in to reply
2 replies to this topic

#1 _259230

_259230

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 April 2012 - 09:49 AM

Let me give this straight everyone !!!!
I'm looking for the code to my RTS game in everywhere but I didn't found it
you know how we choose object is near with our mouse ???
that's the familiar problem in RTS game !!
and I will show the right code !
for objectwhateveryounamedin in step event
if mouse_check_button_pressed(mb_left) and global.put = true {
if position_meeting(mouse_x,mouse_y,cursor_sprite) and collision_point(x,y,object16,true,true) {
global.put = id;   
}
}
if mouse_check_button_released(mb_left)  {
   global.put = true;
   }
and for objectcontrolroom
//if global.grabbed holds an instance id
if(global.put !=true){
//embed code inside that instance
with(global.put){
//to move that instance to the mouse's position
x=mouse_x;
y=mouse_y;
}

}
and that's it ! I found my own code haha !
  • 0

#2 Katuko

Katuko

    GMC Member

  • GMC Member
  • 4886 posts

Posted 28 April 2012 - 10:29 AM

Is there... a question, somewhere in there?
  • 0

#3 _259230

_259230

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 April 2012 - 10:58 AM

no, I just finished my own game poker in how to select the card after the card was shuffling...:) haha..
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users