Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 1 of 1
Thread: Urgent! ASAP! Pls help!
-
02-09-2016, 03:21 PM #1New to the CF scene
- Join Date
- Feb 2016
- Posts
- 1
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Urgent! ASAP! Pls help!
So basically, I need to create a drag and drop game based in actionscript3 which will act as learning platform for students. The drag and drop game will something to a "match it" kind of game. The student would have to complete matching all of the elements before he or she will know the results. If any one of the elements is wrongly matched, it would activate the hints to show however it would not show which of the elements is wrongly matched. Students would have to restart the game if they get any of the elements match wrongly.
I've came across this website and decided to use their codes as reference. I hope some kind soul would help me modify to the requirements mentioned above please and i need it urgently like ASAP :'(
Below are the codes.
Code:package { import flash.display.Sprite; import flash.events.MouseEvent; public class Main extends Sprite { var xPos:int; var yPos:int; public function Main():void { addListeners(den, ocean, jungle, river, forest); } private function getPosition(target:Object):void { xPos = target.x; yPos = target.y; } private function dragObject(e:MouseEvent):void { getPosition(e.target); e.target.startDrag(true); } private function stopDragObject(e:MouseEvent):void { if (e.target.hitTestObject(getChildByName(e.target.name + "Target"))) { e.target.x = getChildByName(e.target.name + "Target").x; e.target.y = getChildByName(e.target.name + "Target").y; } else { e.target.x = xPos; e.target.y = yPos; } e.target.stopDrag(); } private function addListeners(... objects):void { for (var i:int = 0; i < objects.length; i++) { objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject); objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject); } } } }Last edited by VIPStephan; 02-09-2016 at 03:48 PM. Reason: added code BB tags



Reply With Quote
