Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsAt 11/29/14 05:19 PM, CzeryWassierSwizier wrote: I can tell you're not a programmer. :P
If you're feeling adventurous, you can read the fun manual
That isn't fun! That isn't fun at all :(
Also, incase you meant the mouse button low-and-behold:
Button.addEventListener(MouseEvent.CLICK, mouseClick);
function mouseClick (event:Event):void{
gotoAndStop(WhateverFrame);
}
Just restarted and am getting these. Wat.
I've wrote a simple piece of code that draws a circle. But low and behold Flash Develop can't even. I've tested my code out in the flash built-in IDE and it works.
My Code:
package myTestPackage
{
/**
* @author Graham Long
*/
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
var Circle:Sprite = new Sprite;
Circle.graphics.beginFill(0);
Circle.graphics.drawCircle(480, 270, 50);
addChild(Circle);
}
}
Right, so I'm trying to get used to using an IDE (instead of flash itself) as it will help me understand and learn other languages easier later on. Anyway, since I've always just coded straight outta flash...I'm confused very much so actually. Also, how do I see the output panel
Here is a picture highlighting everything I'm confused about:
Well since it's a school project they always have you code on the timeline.
Why? Isn't that kinda counter-productive?
Just do frame-by-frame animation with it slowly developing the shapes. Also, use the animation forum.
I've ended up just using a for loop that keeps removing objects until there isn't any left :/
Is their a piece of code that can remove everything off the screen? Or should I just do it one by one?
At 10/31/14 10:33 PM, Gimmick wrote: Hmm..actually..is coin1 a sprite? Or is it an Object? The function drawCoin(whatCoin) doesn't have any type specified for whatCoin, so you could be passing blanks and it'd create them without any problem AFAIK. Does this work?
I've since deleted the code. But I'mm almost certain this was the problem. Thanks for the help, I'll remember it for in the future.
At 10/30/14 10:48 AM, Diki wrote: It's impossible to say precisely what is causing the errors with absolute certainty since there isn't enough given information, but it looks like the code that is throwing the error isn't being executed in the scope where the coin variables have been defined.
I ended up just doing each coin manually.
drawCoin(coin1);
drawCoin(coin2);
drawCoin(coin3);
drawCoin(coin4);
This works error free. But when I'm trying to set up collision later on it's saying there undefined properties.
Actually, the draw coin function results in the same error.
I'm getting undefined property errors. The thing is, I have defined them.
My Code:
function drawCoin(whatCoin){
var whatCoin:Sprite = new Sprite;
whatCoin.graphics.beginFill(0xFFFFFF);
whatCoin.graphics.drawCircle(randomNumber(15, 945), randomNumber(15, 525), 20);
addChild(whatCoin);
}
drawCoin(coin1);
drawCoin(coin2);
drawCoin(coin3);
drawCoin(coin4);
This works error free. But when I'm trying to set up collision later on it's saying there undefined properties.
Code returning error:
function coinManagement(){
if (square.hitTestObject(coin1)){
removeChild(coin1);
}
if (square.hitTestObject(coin2)){
removeChild(coin2);
}
if (square.hitTestObject(coin3)){
removeChild(coin3);
}
if (square.hitTestObject(coin4)){
removeChild(coin4);
}
}
And for posterity, here are the error message:
Scene 1, Layer 'Layer 1', Frame 1, Line 41, Column 26 1120: Access of undefined property coin1.
Scene 1, Layer 'Layer 1', Frame 1, Line 42, Column 14 1120: Access of undefined property coin1.
Scene 1, Layer 'Layer 1', Frame 1, Line 46, Column 26 1120: Access of undefined property coin2.
Scene 1, Layer 'Layer 1', Frame 1, Line 47, Column 14 1120: Access of undefined property coin2.
Scene 1, Layer 'Layer 1', Frame 1, Line 50, Column 26 1120: Access of undefined property coin3.
Scene 1, Layer 'Layer 1', Frame 1, Line 51, Column 14 1120: Access of undefined property coin3.
Scene 1, Layer 'Layer 1', Frame 1, Line 54, Column 26 1120: Access of undefined property coin4.
Scene 1, Layer 'Layer 1', Frame 1, Line 55, Column 14 1120: Access of undefined property coin4.
Scene 1, Layer 'Layer 1', Frame 1, Line 33, Column 10 1120: Access of undefined property coin1.
Scene 1, Layer 'Layer 1', Frame 1, Line 34, Column 10 1120: Access of undefined property coin2.
Scene 1, Layer 'Layer 1', Frame 1, Line 35, Column 10 1120: Access of undefined property coin3.
Scene 1, Layer 'Layer 1', Frame 1, Line 36, Column 10 1120: Access of undefined property coin4.
Right. So I have this thing where a square moves and I'm currently implementing a coin system where they randomly spawn, when all on the screen are collected, they all respawn. So I've thought of a way. But to make it work I need a bit of code.
What code could you use to see how many are contained. Something like:
if (displayobjects > foo){bar}
This would have been a lot easier if you guys just exchanged skypes.
At 10/27/14 09:41 PM, ForNoReason wrote: Wanted me to choose between hanging out with him and hanging out with my girlfriend. The entire thing seemed stupid to me so I told him to get lost. I then married my girlfriend.
Did you marry her out of spite?
I'm a sandwich. English.
At 10/28/14 02:47 PM, SentForMe wrote:
:even considering that today has now become tomorrow.
England master-race. I'm...I'm sorry.
At 10/14/14 08:41 PM, DM692 wrote: Like
A whole house
Alone?
>_>
At 10/28/14 03:09 PM, NeonSpider wrote:At 10/28/14 02:53 PM, SubparTony wrote: God, I hope you put $ instead of S in your passwordsDon't worry. I use Ke$ha as all of my passwords. Oh you know what? I should probably go change them to Pa$$w0rd. I mean it has $ in it twice, a capital letter, and a number so that must mean it's like Fort Knox levels of safe.
Hunter2
I've ended up just doing myArray[i] instead.
One Code Please.
At 10/24/14 10:04 PM, beakerboy wrote: so the story is even more messed up than it sounds.
I smell a faggot.
Okay, so I'm now trying to loop through arrays. I've taken a look and it seems to be understandable, but I'm having one problem.
coins[0].ID = "sample text";
returns an error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at KeyboardControls_fla::MainTimeline/frame1()
So why does it return an error when I'm trying to define it?
At 10/25/14 05:06 AM, ErikMasters wrote:At 10/24/14 07:19 AM, GrahamNG wrote: Go to top right where it says 'classic', select reset workspace and it should resize all the panels.Ahh. Back to normal. Thank you GrahamNG and everyone else for your suggestions
Happy I could help :)
Okay, so I'm now trying to loop through arrays. I've taken a look and it seems to be understandable, but I'm having one problem.
trace(coins[0].ID = "sample text");
returns an error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at KeyboardControls_fla::MainTimeline/frame1()
So why does it return an error when I'm trying to define it?
I'm getting- ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
I understand what happens, it's trying to remove something that isn't there. But how can I make it not detect the object so that it won't error?
Code:
var Coin:Sprite = new Sprite;
Coin.graphics.beginFill(0xFF0000);
Coin.graphics.drawCircle(300, 250, 40);
addChild(Coin);
rectangle001.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler (event:Event){
if(rectangle001.hitTestObject(Coin))
{
trace("hit");
Coin.visible = false; // Flimsy attempt at making it not detect. What would I put here to remove detection?
removeChild(Coin); // Error from here right?
}
else
{
trace("miss");
}
}
At 10/24/14 02:02 PM, Gimmick wrote: Part of the problem is people pushing newcomers and so on to haxe instead of AS3. Yes it's better but that just worsens the situation. It's like how AS2 newcomers were encouraged to go to AS3, and now AS3 to haxe. (Side note, there needs to be a strikethrough option here)
I'd be interested in haxe but like you said earlier, OP is shite at programming.
Would you be surprised to learn that I am so surprised by that statement that I'm not even quite sure I can believe it?
Why would I believe that you don't believe that?