[COLOR=#000000][FONT=Arial]I’m making a game in AS3 (point & click). I would like to do it for PC and for tablets. But, I’ve got a problem:
[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]In my Pc version, when I go to the inventory and click on an item, the item will replace my cursor and I can dragg it where I went on the screen.[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]In my tactical version, when I click on the item, it will get stuck on the left corner of the screen. I suppose that the problem is that is no cursor in a tactical version…[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Do you know what do I have to change for the tactical version ? (for exemple, the item stay in the middle off the screen and I have to click where I want it to be, no draging.[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Thank you for your help,[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Here is my code for my “dragItem” function :
[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] public function DraggedItem(stageRef:Stage, grabbedItem:Object){[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] this.stageRef = stageRef;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] toolbar = Engine.toolbar;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] usableItems = Engine.usableItems;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] inv = Engine.inv;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] puzzle = Engine.puzzle;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] player = Engine.player;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] linesData = Engine.linesData;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] inv.draggingItem = true;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] Mouse.hide();[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] itemRef = getDefinitionByName(grabbedItem.displayName.toLowerCase()+"Proper");[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem = new itemRef;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] stageRef.addChild(draggedItem);[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.displayName = grabbedItem.displayName;
[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] if (grabbedItem.lookTag)[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.lookTag = grabbedItem.lookTag;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.x = mouseX + x;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.y = mouseY + y;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.scaleX = itemScale;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.scaleY = itemScale;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] stageRef.addEventListener(MouseEvent.MOUSE_MOVE, dragItem, false, 0, true);[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] stageRef.addEventListener(Event.ENTER_FRAME, itemHitTest, false, 0, true);[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.addEventListener(MouseEvent.CLICK, itemClick, false, 0, true);[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] }[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] private function dragItem(e:MouseEvent):void{[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.x = mouseX + x;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] draggedItem.y = mouseY + y;[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue] }
[/FONT][/COLOR]
[COLOR=#333333][FONT=Helvetica Neue]
[/FONT][/COLOR]