Jump to content


Member Since 02 Oct 2006
Offline Last Active Nov 20 2012 10:51 PM

Topics I've Started

Dragging Rts Movement

03 December 2007 - 10:49 PM

Here is a quick and easy tutorial on how to make a common RTS screen movement style by dragging the screen.

//This goes in the create event and all were are doing here is declaring 2 variables
VarXDrag=0; //Creates a variable that will store the difference in X between the original //drag point and the current mouse position
VarYDrag=0; //Same as above but with the Y difference

//This goes in the step event, and this is where all the real code is
    //If the left mouse button is pressed then set VarXDrag equal to the mouse_x and  
    //VarYDrag equal to the mouse_y
      if (mouse_check_button_pressed(mb_left))
    //Checks if the left mouse button is currently being pressed
      if (mouse_check_button(mb_left))
   //Checks to see if the mouse has moved since it was first pressed down
      if (VarXDrag!=mouse_x||VarYDrag!=mouse_y)
    //Finds the difference between VarXDrag and the current mouse_x, checks to      //make sure the mouse isn't out of the room and adds the x difference
      if (view_xview[0]-(mouse_x-VarXDrag)>0&&view_xview[0]-(mouse_x-VarXDrag)<room_width-view_wport[0])
    //Finds the difference between VarYDrag and the current mouse_y, checks to      //make sure the mouse isn't out of the room and adds the y difference
      if (view_yview[0]-(mouse_y-VarYDrag)>0&&view_yview[0]-(mouse_y-VarYDrag)<room_height-view_hport[0])

Make sure that you put all of this in the appropriate spots of an object and place that object in the room you wish the mouse movement to occur. Also be sure that the room you place this object in has view[0] turned on.

Download HERE
Size: 10.2 kb
Its a :) and you don't need registered.

Bouncing Sonar Like Waves

29 October 2007 - 10:48 PM

How would one make a wave (particle, object or other) that has the ability to have the part of it colliding with a solid object reflect back and the rest of the wave keep moving until it hits a solid.

In ^_^ please, but I do have ;) registered also.

Choose Random Instance Of Object

16 September 2007 - 01:42 PM

How would you choose random instance of object, having it return the instance id? When I have been using instance_find(), but it keeps on returning -4.

Annoying Glitch

08 May 2007 - 01:01 AM

I making a Jedi game and in it you can use force pull. When you get as close as possible to an object and use force pull it moves on top of you. Here is the code I used: for ObjSolidParent

if (self.speed!=0)

and in ObjChar1

if (other.speed==0)
idParent)).y),speed+5); //Helps to collide with wall
global.VarCPlayer.speed=0; //Stops ObjMain from going through wall

if (other.speed>0)

if (other.speed<0)

Solved:lengthdir_x Lengthdir_y

24 March 2007 - 07:46 PM

I have sprites that are 21 pixels tall and 18 wide with an origin at 10,9. They are rotating, and I am creating a bullet outside of the object at 31,5. To calculate the difference cause by the rotation I am using this code:

but the bullet isn't always coming out of the barrel.

Help would be much appreciated