You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!

Author Search Results: 'ShirkDeio'

We found 989 matches.


<< < > >>

Viewing 1-30 of 989 matches. 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 92133

1.

None

Topic: As2 Hittest And Gotoandstop

Posted: 10/06/09 12:24 PM

Forum: Flash

Duh. It works that way in the simple demo that uses _xmouse and _ymouse and is always going to have a mouseUp called because we're dealing with clicks. But in my project it's much more complicated, so I need to understand the basic problem, which is why flash is so inconsistent with the hitTesting after the gotoAndStop.


2.

None

Topic: AS2 Class - non-static object vars

Posted: 10/06/09 12:22 PM

Forum: Flash

why don't you give some love to your vars and type them?

I do type them, just not in a quick, slapped together example.

If you want to know the reason for this:
EVERYTHING in flash, apart from the base types, acts as a pointers, whenever you call 'new' (of which declaring an object using {} and arrays using [] implicitly does) it allocates space for that object, whatever type it may be, and gives you a pointer to it.

Ahh, thank you so much. That makes sense. So what are base types? Numbers and strings only?


3.

None

Topic: As2 Hittest And Gotoandstop

Posted: 10/06/09 12:15 PM

Forum: Flash

The first box always works.

The second box works if it's clicked after the third box, or if it's clicked while it's covered by the red block.

The third box only works if it's clicked while it's covered by the red box.

That's what I get consistently. If you can call it consistent -- that's one strange problem.


4.

None

Topic: As2 Hittest And Gotoandstop

Posted: 10/06/09 12:08 PM

Forum: Flash

Anyways, with this weird result, I want to know if there's a good alternative or fix for this so I can finish my project? It would be a pain to have to develop it differently, because the shapes I'm testing in my project aren't just squares, so I can't simply change the _x and _y values to make it work, and they aren't all uniform, so I can't just change the _rotation.


5.

None

Topic: As2 Hittest And Gotoandstop

Posted: 10/06/09 12:06 PM

Forum: Flash

I'm having some problems with a hitTest in a project, so I've been experimenting and I've come up with some really strange results. I'm trying to use hitTest after changing the frame of a movieclip, but for some reason it doesn't work. I assumed it was because the graphics didn't update until the next frame, but when I was experimenting I found that it sometimes works and sometimes doesn't.

Here's the example I made. Here's the code that runs it:

block.gotoAndStop(2);

btn1.onRelease = function() {
	block.gotoAndStop(1);
	txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn1: " + block.hitTest(this);
};
btn2.onRelease = function() {
	block.gotoAndStop(2);
	txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn2: " + block.hitTest(this);
};
btn3.onRelease = function() {
	block.gotoAndStop(3);
	txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn3: " + block.hitTest(this);
};

Click a white box to move the red box (via gotoAndStop) and the text will display first a shapeflag hitTest using _xmouse and _ymouse, then on the second line a hitTest with the white box you clicked.

What I've come up with so far is the hitTest on the box itself always works, the shapeflag hitTest on the far left box always works (it's the red box's frame 1... maybe that changes things?) the shapeflag hitTest on the middle one sometimes works (only after clicking the far right box then the middle box?) and the final shapeflag hitTest doesn't work.

All three hitTests work if you click the place that the red box is already over.


6.

None

Topic: AS2 Class - non-static object vars

Posted: 09/23/09 11:37 PM

Forum: Flash

Wow. ActionScript is weird. I found a fix. Strange to me, but by declaring the object inside the constructor rather than outside, a new object is created rather than a reference to a "static-like" object. Works well enough for me.

Any thoughts?

class MyClass {
	static var default_stats:Object = {health:100};
	var stats:Object;
	
	public function MyClass() {
		stats = {};
		for(var i in default_stats) {
			stats[i] = default_stats[i];
		};
	};
	
	public function changeHealth(amount:Number):Void {
		stats.health += amount;
	};
	
	public function getHealth():Number {
		return stats.health;
	};
}

And in the timeline:

var m1 = new MyClass();
var m2 = new MyClass();
m1.changeHealth(10);
m2.changeHealth(-5);

trace(m1.getHealth());  // Returns expected 110
trace(m2.getHealth());  // Returns expected 95

7.

None

Topic: AS2 Class - non-static object vars

Posted: 09/23/09 11:29 PM

Forum: Flash

I'm working on a class in AS2 and I'm having a problem with variables that are objects behaving as static variables, but I don't want them to do that.

Here's a quick example. I want to use an object to hold several stats for my class (more complicated in the real code -- objects are desirable over several number variables). I have included a number variable to demonstrate what I want the object to do.

// Class code
class MyClass {
  var stats = {health:100,magic:100,stamina:100};
  var health = 100;
  
  public function MyClass() {};

  public function changeHealth(amount:Number):Void {
    stats.health += amount;
	health += amount;
  };

  public function getStatsHealth():Number {
    return stats.health;
  };
  
  public function getHealth():Number {
    return health;
  };
}

// Timeline code
var m1 = new MyClass();
var m2 = new MyClass();
m1.changeHealth(10);
m2.changeHealth(-5);

trace(m1.getStatsHealth());  // Returns 105 instead of expected 110
trace(m1.getHealth());  // Returns expected 110

Interestingly, this works:

class MyClass {
  var stats;
  var health = 100;

  public function MyClass(p_stats:Object) {
    stats = p_stats;
  }
  [..]
}

// Timeline
var m1 = new MyClass({health:100});
var m2 = new MyClass({health:100});
m1.changeHealth(10);
m2.changeHealth(-5);

trace(m1.getStatsHealth());  // Returns expected 110
trace(m1.getHealth());  // Returns expected 110

I may have to construct things by passing objects to the constructor, but it seems like an unnecessary hassle to me. Anyways, I hope I explained my problem well enough. I want to use object variables in my class, but it's treating all my objects like static variables that are the same across all instances, which I do not want. Is there any way around this problem, aside from passing the objects directly to the constructor (basically eliminating any possibility for a default)?


8.

None

Topic: Flash is Locking Up

Posted: 08/26/09 10:49 AM

Forum: Flash

As I've been working on a project, the .fla has gotten slower and slower for loading, saving, and working with. It's only 13MB, so I don't know why it's so slow. But it's pretty bad; I opened up a movieclip and clicked on the first frame, opened the actions panel and typed CTRL+V to paste one line of code inside, and the whole program locked up and I had to end the process from the task manager.

I'm using Flash 8. The project has a large graphics library and loads a few external ActionScript Classes. It has no trouble compiling to a .swf file, but loading, saving, and even pasting a line of code into a frame freezes everything up sometimes.

Any ideas would be greatly appreciated.


9.

None

Topic: Tile-based engine collisions

Posted: 07/17/09 07:22 AM

Forum: Flash

Confusing! If it's non-tile-based, what does it have to do with tiles? Exactly what collisions do you need? Is it top-down? In that case, don't you need a range instead of a single number in the array?

I have my tile-based engine with the basic collision testing - some tiles are open, and some are barriers. But I have special tiles that are round, such as a curved wall. The square tile collisions don't work well with the round graphics.

In the case of tiles that don't conform to all-walkable/all-collision (like triangular ones), you calculate the shape of the tile as a graph and test to see if the points are within the correct area. For instance, a slope formed by the bottom and the right sides of a tile is only passable in the y > x zone. If you're storing the location of your objects in your world in terms of tiles (rather than x-y flash coordinates), it's a simple %1 operation to get thier current y and x related to that single tile

That makes sense. A 45 degree slope doesn't sound too difficult to add there when you explain it that way. Thanks!

For more complex tiles, consider why the hell you have them there in the first place and whether you can make the same game without them

Yeah. Quite honestly, I'd just as soon change it back to regular old square collisions and adjust the graphics accordingly. But, I'm doing the game in collaboration with someone else and they want the abnormal collisions. I guess I can try the simpler collisions (such as regular slopes) and see how that works. At the very least it will work better than the square collisions.

Thanks for the help!


10.

None

Topic: Save Players x And y Coordinates

Posted: 07/16/09 10:56 PM

Forum: Flash

Plus, you are setting it to true then telling it to change it to false. Here's what it should be according to my AS2 knowledge:

if (event.keyCode == 80 && !menu.visible) {
     menu.visible = true;
} else {
     menu.visible = false;
}

11.

None

Topic: Save Players x And y Coordinates

Posted: 07/16/09 10:54 PM

Forum: Flash

Again, I use AS2 so I may be ignorant about some of the changes... but the while function is a loop, and you only want to call the code one time (while looping is used to execute a block of code several times). Change that to "if" and see what you get.


12.

None

Topic: Disabling Context Menu [as3]

Posted: 07/16/09 10:52 PM

Forum: Flash

I'll just confirm what you found. You can't completely disable the contextMenu. There will always be the two items in the menu that you can't get rid of or change.


13.

None

Topic: One Frame Programming

Posted: 07/16/09 10:50 PM

Forum: Flash

All it looks like your code is doing is setting an event handler 5000 times in one frame :\


14.

None

Topic: Save Players x And y Coordinates

Posted: 07/16/09 10:47 PM

Forum: Flash

^ BTW that's AS2. I'm not sure if AS3 variable setting and such has different syntax rules or not.


15.

None

Topic: Save Players x And y Coordinates

Posted: 07/16/09 10:46 PM

Forum: Flash

I agree with Schmastalukas. You could alternatively attach the menu movieclip (rather than change whether it is visible).

For the original question, though, all you'd have to do is save the values in a variable:

mySavedX = character._x;
mySavedY = character._y;

And on resume, place the character back.

character._x = mySavedX;
character._y = mySavedY;

You might not need that now, but you will probably need the concept for other things later on in game development.


16.

None

Topic: Tile-based engine collisions

Posted: 07/16/09 10:16 PM

Forum: Flash

In a tile-based engine, what is the best way to check for non-tile-based collisions?

Right now I'm trying to create "collision masks" that, when needed, are placed as invisible movieclips inside the tile. The code checks the walkability of the tile and comes up with three possible returns - walkable, collision, or it finds a collision mask and consults it to see if there is a collision. I unsuccessfully tried to use BitmapData, overlaying a hitarea for the character and the mask and using a rectangle to find if there was any intersection. Now I'm trying to use hitTest with shapeflag on the mask, passing the x and y positions of my character.

Another method I've thought of but not tried yet is an array instead of the mask. The array would hold 45 values - one for each pixel in the tile (it's 45 pixels wide). Each index would represent the x, and each value the maximum y value for that x position on that tile.

I am also hoping to add in some code that makes the character slide across the tile when going straight into a slanted collision.

Which method (one I mentioned or not) would be effective and can easily implement the slide effect I want, while avoiding high CPU usage?


17.

None

Topic: AttachMovie not working

Posted: 07/14/09 09:01 PM

Forum: Flash

I made it work by adding a line of code. When I removeMovieClip for an old tile, I also delete the old tile so it leaves nothing behind. I'm not sure why it needed that, but it did and now it works.


18.

None

Topic: AttachMovie not working

Posted: 07/14/09 08:43 PM

Forum: Flash

This is an incredibly frustrating problem for me. I'm an advanced ASer (AS2) and I'm having problems with the most basic function here, attachMovie.

I have a tile-based engine I've been working on. I'm using a gotoAndStop engine to scroll the tiles when the character moves. That's where my problem is.

When I go down and right one tile (scrolling) then scroll up one tile, the far left upper tile doesn't go to the proper frame, but plays the tile movieclip.

I spent an hour using trace functions to figure out what was going on, and I found out that the attachMovie function isn't working for that one tile.

I use a for loop to change tiles.

tiles_mc.attachMovie(tile,name,depth);
trace(tiles_mc[name]);

If I trace this on the second-to-last tile, it returns the movieclip. If I trace this on the last tile, it appends a blank line to the output box - there's the problem. It's not the upper left tile that's screwed up, it's the upper right tile that isn't getting placed on the proper x value because attachMovie is screwing up.

tiles_mc.attachMovie(tile,name,depth);
trace(tiles_mc[name]);
trace(tiles_mc.getInstanceAtDepth(depth));

If I trace those on the last tile, the first trace outputs a blank line, and the second trace outputs the correct movieclip!

What is going on? This is crazy, and I have a deadline I'm trying to meet. I would really appreciate any help you could offer.


19.

None

Topic: As2 - Tile-based Engine - Multiroom

Posted: 03/10/09 05:49 PM

Forum: Flash

At 3/10/09 05:00 PM, StaliN98 wrote: Maybe have more properties per tile than just 1 or 0, like (pseudo code)

[solidity:Boolean, textureNumber:Number, linkTo:Array ([roomNo:Number, linkToX:Number, linkToY:Number])]

The link to array is in 3 parts.
roomNo is the index of the room array.
linkToX is where the player's x will be in that room
linkToY is where the player's y will be in that room
Just an idea. At least, that's how I will do it in my engine.

I appreciate the input. That's how I used to do it in my old engine, but it became crowded. I ended up with hundreds if not thousands of tile prototypes and I had to remember which tile led to which room. This also doesn't work with the code I'm using to scroll the screen.

I am, however, using tile prototypes (i.e. for solidity and texture) in the real code. I just don't want to specify a direct x and y value for the character on the new room.

At 3/10/09 05:01 PM, Doomsday-One wrote: Firstly, working with rooms of different sizes is a little weird. Lots of scaling issues if you do it one way; or the other would mean a single array would suffice.
Not questioning it, just I hope you know what you're doing =)

I have code so that the screen scrolls. The maps are actually much larger than the 5x5 in my example. So one room could be a hallway that's 80 tiles high, but a couple rooms it branches off to on one side could be only 10 tiles high (because they aren't hallways).

For going between rooms, you could use a sort of linkage letter or number. For example, give the 'doorway' the letter 'a' at the entrance in one room, and the exit in another.
Then, when the character goes to 'a', check the arrays (or pre-store the exact locations for added ease) for the exit, and put the character there.
Also, you would probably want to stick in your code to put a blank tile (0) wherever the array value is not a number (or just stick a blank tile when the value is not greater than 0).

Thanks, that makes sense. Rather than keeping the rooms in a multidimensional array, I'll put them in just a normal array and use their indexes to link to other rooms.


20.

None

Topic: As2 - Tile-based Engine - Multiroom

Posted: 03/10/09 04:54 PM

Forum: Flash

I'm working on a tile-based engine. It was working fine with code like this:

var room1 = [ [1,1,1,1,1],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0] ];

var room2 = [ [1,1,1,1,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1] ];

var room3 = [ [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,1,1,1,1] ];

var room4 = [ [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [1,1,1,1,1] ];

var rooms = [ [ room1, room2],
                        [ room3, room4] ];

1 = barrier
0 = moveable area

I have it coded so that when the player reaches the edge of the current room, it checks the "rooms" array to see if there's another room to go to (for example, if a player is in room 4 and on the left edge, it checks for a room to the left in the rooms array, i.e. index - 1).

This worked well until I realized it's no good if the rooms are not the same size. Here's an example of the rooms I want to implement now:

var room1 = [ [1,1,1,1,1],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,1],
                        [1,0,0,0,1],
                        [1,0,0,0,1],
                        [1,0,0,0,1],
                        [1,0,0,0,1],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,0,0,0,0],
                        [1,1,1,1,1] ];

var room2 = [ [1,1,1,1,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [1,1,1,1,1] ];

var room3 = [ [1,1,1,1,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [0,0,0,0,1],
                        [1,1,1,1,1] ];

Room 1 is on the left, rooms 2 and 3 are on the right (two towards the top, 3 towards the bottom). But this doesn't work with the "rooms" array from above. How would you suggest I organize the rooms so that the code can recognize what room to go to based on where in the current room the character is?


21.

None

Topic: Free Flash Decompiler?

Posted: 01/31/09 05:57 PM

Forum: Flash

What Flash Decompiler do you recommend, preferably free? I found two "free" ones that cost $40 after you install them :\


22.

None

Topic: Swf >> Avi Converter?

Posted: 01/31/09 05:15 PM

Forum: Flash

At 1/31/09 04:37 PM, Magical-Zorse wrote: You can't convert a swf to an avi, you have to export them as one

So, how can I export as an avi? It's not an option in my Publish settings.


23.

None

Topic: Swf >> Avi Converter?

Posted: 01/31/09 04:47 PM

Forum: Flash

Pazera is supposed to convert swf files as well, but I tried it and couldn't get it to work. Thanks for the link, though.


24.

None

Topic: Swf >> Avi Converter?

Posted: 01/31/09 04:32 PM

Forum: Flash

I was wondering if there was a good way you know of and recommend that converts Flash .swf files into other video formats, such as .avi. I want to do this to put some Flash animations on my iPod. I've seen a few things on the internet, but I wanted to know if there was anything you specifically recommend.


25.

None

Topic: Sidescrolling Platformer Help

Posted: 01/13/09 09:49 AM

Forum: Flash

At 1/10/09 10:52 PM, TazarTheYoot wrote: Hmm, neither of those work.

It works perfectly for me, so you just don't know how to implement it.


26.

None

Topic: Sidescrolling Platformer Help

Posted: 01/10/09 10:26 PM

Forum: Flash

Kind of like this:

if((character._x < 100 && dir == -1) || (character._x > Stage.width - 100 && dir == 1)) {
level._x -= speed * dir;
} else {
character._x += speed * dir;
}

If the character is by the left side and going left, or by the right side and going right, then move the level. Otherwise, move the character. In the first part, you'll have to put other things you want to move (i.e. enemies or whatnot).


27.

None

Topic: Portal Collab!

Posted: 12/24/08 01:41 PM

Forum: Flash

Woo, this took a long time! I can't wait to see it, I will certainly support this when it comes out.


28.

None

Topic: Heatseeking Missiles - Locking On

Posted: 12/24/08 01:35 PM

Forum: Flash

Perhaps a combination of 2 and 3? It locks on to the first unique enemy it finds, based on prioritized areas?


29.

None

Topic: Heatseeking Missiles - Locking On

Posted: 12/24/08 01:34 PM

Forum: Flash

At 12/24/08 01:30 PM, KaynSlamdyke wrote: This one. Seeing as when you shoot a missile in a direction, you'd expect it to prioritise in that direction. Heatseekers that explode on contact with any solid in a game are to be expected, and no gamer wants to fire a missile forwards, only for the game to pick up priority on an enemy behind the player and crawl back up the rocket launcher to explode.

Thanks for the input. I have it set so that it rotates a little at a time (i.e. if it's locked on behind the player, it goes out, arcs up, and then goes backward). Even so, prioritizing directions doesn't sound like a bad idea.


30.

None

Topic: Heatseeking Missiles - Locking On

Posted: 12/24/08 01:25 PM

Forum: Flash

I appreciate it, guys. Thanks!


All times are Eastern Standard Time (GMT -5) | Current Time: 05:35 PM

<< < > >>

Viewing 1-30 of 989 matches. 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 92133