dimanche 15 janvier 2017

Flash CS4 How do you set variable to the Object Dragging Collison?

I am doing a game for my computer science class and I am working on inventory, dragging an item into it. I do not know how to set the item as whatever the user clicked to drag.

At the moment I hard coded it to the item they are dragging, but in the future I want more items, so a variable set to the item they are dragging would make it work perfectly, but I don't know what it's called to do that.

Here is my code for inventory item dragging

function dragItem (event:MouseEvent):void

function dropItem (event:MouseEvent):void

    if ((knife_loot.hitTestObject(inv_game)) && (inv_game.visible == true))
        trace("Item dropped in inventory")

        knife_loot.x = 80
        knife_loot.y = 120

// end of dragging and dropping items

Aucun commentaire:

Enregistrer un commentaire