• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[Solved] Passing a variable into a created object?

M

MCKOY

Guest
I'm trying to make it so when a character's attack creates a hitbox, it passes a couple things into it which would be different for each character(it's team and damage). Right now, my code will work if I manually enter these figures in the hitbox creation like this.
Code:
if(can_attack == 1)
    {       
        attack_direct = point_direction(x,y, target.x, target.y)
        with(instance_create_depth(x+lengthdir_x(range, attack_direct), y+lengthdir_y(range, attack_direct), 0, obj_hbox))
        {
        team = 2
        dmg = 5           
        }
But I've tried every different way I can think of writing them as variables instead and passing them through but none work.
 
Top