Drag And Drop DnD attach instance to another for the whole game? GMS2

M

Mimsical Games

Guest
I'm trying to make turrets on a spaceship, and for the life of me I can't figure out how to attach the turret instance to the ship in the Drag and Drop interface. The turrets would need to follow the movement and rotation (and their own offsets) of the ship sprite. Any help would be appreciated! :)
 

CloseRange

Member
persanoly i would just go to step event and use code:
Code:
x = obj_ship.x;
y = obj_ship.y;
image_angle = obj_ship.image_angle;
but if you insistttttttt:
put these in step event:
under move tap there is a section called "Jump" the first icon that looks like an arrow to a dot is called "Jump to Position"
for the x and y (just like in the code) type these in:

x: obj_ship.x
y: obj_ship.y

make sure Relative is NOT checked
as for rotation im not sure if there is a button for that but just go to the control tab drag in the first block under "Variables"
type in these values:

variable: image_angle
value: obj_ship.image_angle
(again just like in the code


for a learning experiance:
the reason i put "obj_ship."
in front of the variables like obj_ship.x or obj_ship.image_angle is because that is how you refrence a variable from another object

Hope this helped! :D
-CloseRange
 
M

Mimsical Games

Guest
So, wait.. how do I set variables in this program? I'm using Drag and Drop because of a learning disability, syntax completely drives me up the walls because I can't remember it.. When I'm dealing with visual scripting I find it much easier to understand.

I have the turrets at an offset of the origin of the ship, which makes it so difficult.. each step the turret tries to run this: jump to point at: obj_playership.x + lengthdir_x(obj_playership.sprite_xoffset,obj.playership.image_angle), obj_playership.y + lengthdir_y(obj_playership.sprite_yoffset,obj.playership.image_angle) just spits out an error that there's undefined variables, even though I linked the base object directly :/
 
S

Specter

Guest
So, wait.. how do I set variables in this program? I'm using Drag and Drop because of a learning disability, syntax completely drives me up the walls because I can't remember it.. When I'm dealing with visual scripting I find it much easier to understand.

I have the turrets at an offset of the origin of the ship, which makes it so difficult.. each step the turret tries to run this: jump to point at: obj_playership.x + lengthdir_x(obj_playership.sprite_xoffset,obj.playership.image_angle), obj_playership.y + lengthdir_y(obj_playership.sprite_yoffset,obj.playership.image_angle) just spits out an error that there's undefined variables, even though I linked the base object directly :/
There is a vairiable section in the control tab, Set a Variable, Test a Variable, and Draw a Variable.
 
Top