Be a Supporter!
Response to: Changing contentPath with button? Posted March 5th, 2009 in Game Development

At 3/5/09 03:32 AM, Denvish wrote: here's some relevant code:

There's some irrelevant code in there too, eg stopd and b_pause, the Instance Name of the MC on stage was VP (set to Class: mx.video.VideoPlayer in the library). The Video component itself is set to Video (Actionscript-controlled) in the library properties, and placed inside the VP MC.

Hope that sort of makes sense - if not, try this (set to import from a flv filename variable appended to the swf eg VPlayer.swf?flvName=Video01 - should be adapted easily enough)

Response to: Changing contentPath with button? Posted March 5th, 2009 in Game Development

At 3/4/09 11:49 PM, 16Bits wrote: I want to change what video gets loaded into the player based
on which button is selected.

I built a YouTube-style video player a while back, I can't remember exactly how it all works, but here's some relevant code:

import mx.video.NCManager;
import mx.video.VideoPlayer;
var _dummy:NCManager;
var VP:VideoPlayer;
flvName="Video01";

b_play.onPress=function(){
	if(VP.playheadTime==VP.totalTime){
		VP.playheadTime=0;
	}
	VP.bufferTime=1;VP.width=400;VP.height=320;VP.autoRewind=false;
	VP.addEventListener("progress",LoadProg);
	VP.addEventListener("complete",EndIt);
	VP.play(_root.flvName+".flv");
}

function LoadProg(eventObj:Object):Void{
	PC=VP.bytesLoaded/VP.bytesTotal*100;
	loadBar._xscale=PC;
}
function EndIt(eventObj:Object):Void{
	pausd=1;b_pause._visible=0;b_play._visible=1;
}

onEnterFrame=function(){
	if(!pausd){
		playBar._xscale=(VP.playheadTime*1000)/(VP.totalTime*1000)*100;
		if(stopd){stopd=0;VP.play();}
	}else{
		VP.pause();
		stopd=1;
	}
}

I guess to choose different videos you should just be able to create an array of the flv filenames/paths (in quotes) and pull an item out of that array for the flvName variable.

Response to: Custom Cursor Crap Posted March 4th, 2009 in Game Development

At 3/4/09 02:44 AM, DaSexCPikle wrote: I made my own cursor which exist on scene 2, the MC named 'cursor'
in cursor;

onClipEvent(enterFrame){
this.swapDepths(99998)
Mouse.hide()
startDrag(this,true)
}

The 2nd cursor that appears follows the mouse but the aiming MC doesn't respond to it.

Well for starters that code should be running onClipEvent(load), not enterFrame.

Secondly, if you're skipping straight from Scene 1 to Scene 3, the cursor from Scene 2 shouldn't even be getting created, double-check to make sure you're avoiding playing even one frame of Scene 2.

Thirdly, if all else fails, give the cursors different Instance Names and use _root.instancename.removeMovieClip(); to delete previous cursors from within the onClipEvent(load) function

Response to: Competition Time: Drawing In As Posted February 25th, 2009 in Game Development

At 2/25/09 02:11 PM, Deadclever23 wrote: Come on peoplez you know you wanna try.

I'm going out right now but I'll definitely be up for this later.

Response to: My Cartoon Self Posted February 25th, 2009 in Game Development

http://home.howstuffworks.com/drawing.ht m
http://www.arthistoryarchive.com/arthist ory/artlessons/How-to-Draw-People.html
http://figure-drawings.com/drawingpeople .html

I'm sure I've seen art tuts on the portal too, but the search isn't working for me atm

Response to: Scene problems. Posted February 25th, 2009 in Game Development

At 2/25/09 11:17 AM, MrSaint wrote: Thank God before this I copied the .fla into another folder. Do you suggest that I Make Scenes in diffrent .fla's and in the end connect all of them together?

No good asking me, I never work with Scenes because they tend to cause problems with AS, particularly audio. I guess that should work, though.

Response to: Scene problems. Posted February 25th, 2009 in Game Development

At 2/25/09 11:10 AM, MrSaint wrote: I saw only red blocks, no sprites that I animated!

Doesn't sound too hopeful. Do you get 'corrupted file' messages when you open the fla?
Don't know what to say except get into the habit of saving the fla every 20-30 minutes under a new filename, so you can go back to a previous version if things get screwed up or the program crashes.

Response to: Need Help with a Logo Posted February 25th, 2009 in Game Development

At 2/25/09 06:45 AM, Kirk-Cocaine wrote:
At 2/25/09 06:21 AM, Denvish wrote:
At 2/25/09 06:10 AM, Kirk-Cocaine wrote:
At 2/25/09 05:50 AM, Denvish wrote:
At 2/25/09 01:04 AM, Magical-Zorse wrote: Here, I made you one
Tweaked with rainbow gradients, bevels, and other unnecessary filters for extra COOL
Added extra cool background.
Can't beat a bit of unprovoked lens flare for COOL+5
Say what, say what?

I've spent all day thinking about it, and I don't think there's any way I can really improve on that.
Unless.......... hm...

Need Help with a Logo

Response to: Please help me! Posted February 25th, 2009 in Game Development

At 2/25/09 08:23 AM, ronn86 wrote: var touchingGround: Boolean false;

Only error I get is on that line, which should be

var touchingGround: Boolean = false;

Response to: Money system help. Posted February 25th, 2009 in Game Development

At 2/25/09 10:15 AM, drip wrote: I was wondering if I would have to make a new variable that stores the old amount of money you made and have the new money you make from future hauls add to it? And if so how?

If you can program that other stuff I'm surprised you're having trouble with this. Simply have two variables, totalCash and tripCash, which both start at 0. When out fishing, add to tripCash. Back at port, add tripCash to totalCash and reset tripCash to zero

Response to: Stop animation Posted February 25th, 2009 in Game Development

At 2/25/09 07:04 AM, spitfire19er wrote:
At 2/24/09 08:21 PM, Ashed-Dreams wrote: Contact tom and tell him about your movie. Don't rape the quality.
I'm somewhat new to NG, so how do I contact this Tom fellow?

tom@newgrounds.com
Basically as admin/owner of NG he can submit larger files on behalf of authors, at his discretion.

However, I have to say that 33Mb for 20 seconds of animation is excessive, even for stop-motion.
Consider either resizing images externally before import, or lowering the export quality using the sliders in File>Publish Settings

Response to: Need Help with a Logo Posted February 25th, 2009 in Game Development

At 2/25/09 06:10 AM, Kirk-Cocaine wrote:
At 2/25/09 05:50 AM, Denvish wrote:
At 2/25/09 01:04 AM, Magical-Zorse wrote: Here, I made you one
Tweaked with rainbow gradients, bevels, and other unnecessary filters for extra COOL
Added extra cool background.

Can't beat a bit of unprovoked lens flare for COOL+5

Need Help with a Logo

Response to: Need Help with a Logo Posted February 25th, 2009 in Game Development

At 2/25/09 01:04 AM, Magical-Zorse wrote: Here, I made you one

Tweaked with rainbow gradients, bevels, and other unnecessary filters for extra COOL

Need Help with a Logo

Response to: how do i get more FPS for my game? Posted February 25th, 2009 in Game Development

I suspect that the lag is as much to do with the code that's running, as the filters. The number of moving sprites with some kind of AI (move/attack), plus the variable terrain detection, it's all going to add up to a fair whack of processing power, especially with the individually animated body parts on top of that. The fact that you hit an infinite loop if you die by falling off the left hand end suggests that all is not as it should be in terms of the code. Check it through for unnecessary loops and if possible only run functions when they're needed.

Response to: Changing flash frame rates Posted February 25th, 2009 in Game Development

It's certainly possible to drop the framerate, but if it's only running at 12 FPS you aren't ever going to get a satisfactory simulation of 24 FPS. Even if you use an interval or getTimer() to force more frequent frame changes, they'll still only be processed and rendered at 12 FPS, so you'll end up with jerky movement.

Much better to start off at with the project framespeed at 30FPS, use AS to drop it to 12 FPS at run time and then again to jack it up to 24 when required

Response to: heres a quick one. Posted February 24th, 2009 in Game Development

Still not sure exactly what you're asking, but try this. It's your current code compressed and with a pdist variable thown into the onClipEvent(load) - change pdist for the distance you want the enemy to stay above by

onClipEvent (load) {
	var egrav:Number = 0;
	var scale:Number = this._xscale;
	var pdist:Number = 40;
}
onClipEvent (enterFrame) {
	_rotation += 5;
	if (_root.player._x>_x) {_x += 2;}
	if (_root.player._x<_x) {_x -= 2;}
	if (_root.player._y>_y+pdist) {_y += 2;}
	if (_root.player._y<_y) {_y -= 2;}
	if(_y>_root.player._y-pdist){_y=_root.player._y-pdist;}
}
Response to: heres a quick one. Posted February 24th, 2009 in Game Development

At 2/24/09 07:17 PM, baboop wrote: but stay on top of him the whole time?

Not sure what you mean by that

Response to: ActionScripted Barriers? Posted February 24th, 2009 in Game Development

At 2/24/09 06:35 PM, TheGoldenMonk wrote: The code ends up with syntax errors, and I can't figure out where.

Would help if you posted the code you're currently using, and the syntax errors

Response to: ActionScripted Barriers? Posted February 24th, 2009 in Game Development

At 2/24/09 04:59 PM, TheGoldenMonk wrote: What exactly is vX and vY, because flash isn't recognizing it at all. Is it a variable I have to set up? or a special one, like "i" ?

Generally vX/vY or xvel/yvel are used for horizontal (_x axis) and vertical (_y axis) velocity. In your case, vX is the walking speed and vY is the jumping/falling speed

Response to: Happy Birthday UnknownFury! Posted February 24th, 2009 in Game Development

Many happy returns

Response to: function question Posted February 24th, 2009 in Game Development

Basically if the function is on the main timeline, you need to call _root.tracks()

The parameter you're sending/recieving (mc) doesn't actually appear to be necessary, as it's not referenced in the function (unless as _root.mc, which would probably need to be _root[mc] instead

Hopefully that makes some kind of sense

Response to: Transparent Background Posted February 24th, 2009 in Game Development

Dunno whether Powerpoint uses or is similar to HTML at all, but you can embed a swf in an HTML page and add the parameter "wmode", value "transparent" to the swf object/embed tags, ie

<param name="wmode" value="transparent" />
Response to: Resizing an200 image Posted February 24th, 2009 in Game Development

At 2/24/09 11:27 AM, Alwaysmental wrote: Thanks, it worked but its all squished im just going to give up and make my own sig with my imaginaton :D

Yeah well 200x400 is never going to resize well to 599x50, try starting with a wide short image instead, or resizing the image to 599 wide with lock aspect ration on, and then cropping out a section of it 599x50.

I find the max 50 height pretty constricting personally. Talking of which, probably time I changed my sig

Response to: Site-lock help Posted February 24th, 2009 in Game Development

onEnterFrame = function () {
	textbox2.text = domain;
	urlStart = _url.indexOf("://") + 3;
	urlEnd = _url.indexOf("/", urlStart);
	domain = _url.substring(urlStart, urlEnd);
	if(domain.indexOf("www.")>-1){
		domain=domain.substr(4);
	}
	if (domain != "guil07.freehostia.com") {
		textbox.text = "BAD";
	} else {
		textbox.text = "GOOD";
	}
};
Response to: Resizing an200 image Posted February 24th, 2009 in Game Development

At 2/24/09 10:30 AM, Alwaysmental wrote: Sorry for the 200 in the title didn't notice it, it has nothing to do with my problem.
p.s sorry for the double post

Not used Paint.NET, but make sure the 'Lock Aspect Ratio' (or similar) is turned off in the resize options

Response to: ActionScripted Barriers? Posted February 24th, 2009 in Game Development

At 2/23/09 12:16 AM, Johnny wrote: Has to be:
this._x += this.vX;

Doh, can't believe I didn't notice that.

At 2/24/09 12:37 AM, TheGoldenMonk wrote: The Barrier works, but now I have a new problem. When you hit the barrier with the character, it bounces into the block slightly, and you can get stuck inside of it.

Make sure your character is centred in the MC (or create a smaller internal MC to run the hitTest on).
Also, add another player._x+=player.vX; player._y+=player.vY; directly after the vX/vY reversal on detecting hitTest as true, ie:

player.onEnterFrame=function{
	this._x += this.vX;
	this._y += this.vY;
	if ( this.hitTest(_root.barrier ) ){
		this.vX*=-1;
		this.vY*=-1;
	       this._x += this.vX;
	       this._y += this.vY;
	}
}
Response to: double jump? Posted February 24th, 2009 in Game Development

Something like this, but it'll probably need adapting in places

onClipEvent(load){
	moveSpeed=15;
}

onClipEvent(enterFrame){
	this._y+=16;
	if(Key.isDown(Key.UP)){
		if(!jumping){
			player.gotoAndPlay(3);
			vel_y=45;
			jumping=1;
		}
		if(!doublejumping && jumping && _y<_root.ground._y-100){
			player.gotoAndPlay(4);
			vel_y=45;
			doublejumping=1;
		}
	}
	if(jumping || doublejumping){
		vel_y -= 2;
		if(vel_y<=-15){vel_y=-15;}
		this._y-=vel_y;
	}
	while(_root.ground.hitTest(_x,_y,true)){
		vel_y=0;_y--;jumping=doublejumping=0;
	}
	while(_root.ground.hitTest(_x+15,_y-10,true)){
		_x--
	}
	while(_root.ground.hitTest(_x-15,_y-10,true)){
		_x++
	}
	while(_root.ground.hitTest(_x,_y-80,true)){
		_y++
	}
}
Response to: Text based game input help Posted February 23rd, 2009 in Game Development

Change the input textbox var to inTxt and the dynamic textbox var to dynTxt

Add this to the main timeline

kl=new Object();
kl.onKeyDown=function(){
	if(Key.getCode()==13){  //ENTER
		dynTxt=inTxt;
	}
}
Key.addListener(kl);