ActionScript 3.0 :: Create A Game That Has Weapon And Target For Mouse/
Aug 19, 2011
I am trying to create a game that has a weapon and a target for the mouse. Example in my attachment. I know how to make the buy button but how can I switch out for other weapon choices.
View 1 Replies
Similar Posts:
Apr 2, 2011
I'm having a bit of a problem with a weapon class I created for a 2d game I'm making. An instance of the weapon class is created in my player class, whenever a user clicks the mouse button I create a bullet on the stage (bullet is also another class) and pass it to the weapon class. Below is the weapon class so far with the bullet functions.
ActionScript Code:
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.events.Event;
import classes.Avatar;
import classes.Weapon;
import classes.Bullet;
private var aBullets:Array = new Array();
[Code] .....
The problem is I keep getting this error:
TypeError: Error #1006: splice is not a function.
at classes::Weapon/::BulletHandler()
Am I forgetting to import some file for the splice?
View 3 Replies
Apr 29, 2011
I'm new to AS3 and OOP in general and I'm trying to create a cursor class for a mouse avoider game, i.e a class whose position is mouseX, mouseY. This is where I'm at (the Avatar class in added to the stage in a Main class not shown):[code]But this doesn't work, I guess I have to refer to the mouse in some other way? I also tried using MouseEvent.MOUSE_MOVE which got me closer, but the avatar only moved when my mouse was directly at the center of the movieclip.
View 7 Replies
Oct 18, 2005
I want to create a sidescroller game in which the characters arm rotates according to the mouse position(for aiming). I am no stranger to flash, I've been using it for years.
View 2 Replies
Aug 23, 2011
i made a character that has 5 frames:
1st nothing
2nd axe
3rd spear
4th sword
5th bow
i am trying to make it so the weapons will switch when i press the a,b,c,d,e button on the keyboard( i will figure out the actual button l8r) i have made a mc clip button to make it switch which works but i cant figure out how to do it from the key board
[Code]...
View 1 Replies
Mar 28, 2012
im trying to create a tamagotchi game type game. For some reason i can not add any items to the stage.Currently i have imported 2 png images to the stage and coverted them to movie clips. One is called TamagotchiCharacter and the other is called Beer. I have also created a new 2 AS3.0 script class called TamagotchiGame and DraggableItem. The following is TamagotchiGame:
Code:
package {
import flash.display.MovieClip;
public class TamagotchiGame extends MovieClip {
[code]....
I have assigned the above code as the BaseClass of the Beer symbol, this has allowed the beer to become draggable and droppable etc.when i run the program nothing happens, i just get a blank white screen.
View 2 Replies
Oct 13, 2002
im makin a game.... and i want to be able to delay the weapon even if the button is held down... like in this...
http:[url]...
how would i go about doing that?... the only reason is cuz right now my game lags so bad if i just hold dow the button cuz so many movie clips on the screen at once...
View 4 Replies
Mar 22, 2011
I'm making target shooting game and the hitTestObject not working its located in the function collision detection below in my code:
import fl.motion.MotionEvent;
import flash.events.MouseEvent;
var xSwitch:Array = new Array ;
var count:Number = 120;
var seconds:Number = 0;
var minutes:Number = 0;
[Code] .....
View 1 Replies
Oct 25, 2010
There's clearly a bunch of new stuff in Flash 10, I'm seeing a bunch in the Graphics class so far. Struggling a bit to reconcile it with what I know already but it looks useful - render lists and 3D transforms, etc - however I wondered if there are good arguments for targeting Flash 9 since I can definitely manage without all the new stuff I don't know. Like support on non-Windows devices, wide adoption of Flash 9 Vs 10, etc.
View 1 Replies
Feb 29, 2012
I've created a simple drag 'n' drop game and I want the color of the target to be changed only when the user puts inside it all the text frames.
The instance name of the target is "targetCircle" and that of the text frames is "circle_mc", "circle1_mc"....."circle5_mc".
View 0 Replies
Feb 13, 2010
how to manage the target of a mouse event. As everyone knows, if I use localX/Y property on a mouse event, I'll get the x/y coordinate of the curson referred to the target Sprite. But if I need these coordinate referred to another Sprite, layed in the bottom of the stage (therefore unreachable for the event), how can I do for these?
View 1 Replies
Jul 10, 2009
I'm having trouble retrieving a name from my mouse event target, so that I can tell which target was clicked.I have two buttons, forwardArrow and backArrow. The listeners on each arrow point to the same listener function in which I want to differentiate between which button was just pressed.I can't get any name but the class from event.target.What's the best way to differentiate between these?[code]
View 3 Replies
Dec 15, 2011
I have a container MovieClip with 50 movies inside all different names and I need to find what movie was clicked.
ActionScript Code:
for(var str in this){
if(typeof(this[str])=="movieclip"){
[code]....
trace works but how do I know what MovieClip was clicked?
View 3 Replies
Aug 11, 2010
How to get general id (or) name from xml loaded images. bcoz, i want to drag and drop that images in generic method. Now, i currently used the event.target.name for each one.[code]
View 1 Replies
Jul 30, 2009
Is it possible to define the target of a MouseOver event being sent to a method if it is being triggered by code and not an actual mouse event? By typecasting a string as a mouse event the receiving function is sent an acceptable value required by it to run. It will then go about executing it's tasks but if it has references to the target property an error is thrown because only the event type was sent to the function and none of it's properties.
ActionScript Code:
private function myFunction(event:MouseEvent):void {
trace(event.target.name);
} myFunction(new MouseEvent("mouseOver"));
Resulting error:
Error #1009: Cannot access a property or method of a null object reference.
Is there a way to send the target information along with the event when triggering a method in this way?
View 6 Replies
Jun 9, 2006
I've been going through some tutorials and samples of "drag and drop" flash movies and I always come upon the same bug. The drop target gets "stuck" to the mouse, and when I click the target it just drops down and doesn't return to its orig. position. This mostly happens when the target in the "lower order" is dropped behind a target that is "in front of it" Now I have used the [code]...
View 7 Replies
Nov 6, 2007
I'm trying to modify a mouse trailer I've found somewhere else so that it only reacts within a specific area on the flash page - say an area 780x549 on a 1024x700 flash file.Here is the code I am starting with - The file is written in AS2 for Flash 8+
//mouseTrailer
i=0
onMouseMove = function () {
var cur_x = _xmouse;
[code]...
View 1 Replies
Aug 24, 2011
I'm having toruble with an image that I zoom into in flash. I got everything to work, only I want the clicked X and Y coordinats to center to the stage. ( so that the area clicked on always zooms in and position the area clicked to the middle of the stage) the image is a movieclip and it zooms with a tween, but i tried everything but the image wont center the stage..
does anyone have a clue for wich actionscript 3 code I can use to do this?
my code is:
const TWEEN_IN:String = "tweenIn";
const TWEEN_OUT:String = "tweenOut";
var tweenDirection:String;
[Code]....
View 1 Replies
Sep 8, 2009
I want to do somthing like this:
Code:
function createObject(evt:Event):void
{
[code].....
View 8 Replies
Nov 1, 2009
I'm trying to make some sort of game where the player is to "escort" a color to a target. The user starts as gray and the player is painted one of four colors when he hits one of the boxes on the screen. The game is over when the player's object is the same color as the target's color and they touch. All this is realized, except a part where the target is a different color every time the game restarts. So far I have
ActionScript Code:
public function randomcolor():void
{
[code]....
The target has a color assigned to it; winrar.color which is working. How do I get things working so the target is actually colored correctly?
View 2 Replies
Mar 2, 2011
I want to be able to create the following if possible:
Create five words that make up a sentence and they are mixed up in order. So basically I would turn each word into a Movie clip perhaps.
I would then like to assign a target hotspot for each word so that a user can drag the words into the correct order.
Once they are in the correct order they click a button to go to a correct response or incorrect response. Is this possible?
View 1 Replies
May 27, 2009
i am trying to do a simple blackboard on mouse down, start drawing on mouse move, if drawing, draw line on mouse up, stop drawing i set the listeners on a simple clip with a rectangle. if i dont fill the rectangle, the mouse events wont fall into the rectangle, but if i fill the rectangle, it will paint behind the rectangle, so anyway i wont see any succesfull results. what i did was create another sprite and paint within it; something like
[Code]...
View 3 Replies
Feb 11, 2011
iam planning to make a flashgame that requires the player to aim with his mouse. so there will be a crosshair. now i have the problem that whenever the mouse leaves the embedded flash stage and clicks outside this frame.. the player has to click in the flash field again to be able to play again. that sucks. is it possible in flash to lock the mouse in the gamewindow?
View 2 Replies
Jan 30, 2009
I'm not sure if it's possible, but can you override a variable of a parent class like you can override a function? I'm trying to create my own event class that can handle the target property. I have a custom imageLoader class, but when it dispatches it's loading complete event:
ActionScript Code: dispatch(new Event("load_complete")); and a listener picks it up, e.target = null where I would like e.target to equal the imageLoader instance that has finished loading.
Does anyone have an answer or a better way to accomplish what I am aiming for?
View 1 Replies
Jul 22, 2010
I'm creating an number of games for my HSC major project and I'm having trouble with creating a colouring in book. This is the code I have:
[Code]...
It works although when I test the movie no matter what colour the player chooses it always colours in red,
View 7 Replies
Aug 11, 2010
I want to create a flash game (a simple drag and drop, probably) and at the end of it, if the user wins, I wanna send him/her to a "certificate" page where there will be a certificate that I have designed. The user will then have the option of printing this certificate.
View 1 Replies
Aug 29, 2007
I have this problem when i go to shot and then have shot the gun all movie clips accessed after shooting dont stop playing but repeat continuously[code]...
View 1 Replies
Dec 24, 2011
I've been reading a lot about the benefits of Object Pooling. Found some "tutorials" online, all above my skill level. Can anyone please show me an extremely simple example of an Object Pool. What my game does is creates Ball objects when the user holds down the mouse, stops when user lifts up mouse. I need to store these Ball objects in an array(or Vector), and hit test them with other objects, removing them from the stage when the hit another object. I'd like to create a pool of say 20 of so, created once, and recycle them.
[Code]...
View 1 Replies
Feb 25, 2010
I am developing a game like this. [URL]. I just start this game And stuck in a problem. Moving arrow of game according mouse moveing like Given URL just check out. I know it is just a mathematical calculation. I have done according X position of mouse moving. But confuse something With Y position also. So I am not getting proper solution of X & Y position Both Togather.
View 2 Replies
Apr 21, 2005
I have a menu for a website in flash where, an mc moves up and down and shoots...so that when the projectile MC hits a button, it clicks it.
1.) How do I make it so that the MC follows the mouse (like a custom cursor)..but is restricted to only going vertically
2.) how would you make it so that the mc can shoot anywhere....but when the fired MC hits a button, it acts as if it was clicked? My AS knowledge...is..very basic...so if you have any free time could you explain the codes?...so that I can learn from this...rather then just stealing your codes... but..if you want to just let me copy and paste...thats cool too
View 12 Replies