Be a Supporter!
Response to: Big Project, Need help. Posted February 1st, 2009 in Game Development

At 2/1/09 11:35 AM, ThePeasant wrote: Hope that helps!

Thanks! This has actually been more helpful than Flash's documentation I've been trying to read through. Now I finally understand how to instantiate MovieClips right. I had been doing this:
Make a movie clip, do the linkage stuff so it's name would be "blah". and then try to instantiate it with:

var blah:Movieclip = new Movieclip();

Flash's help documentation seems really unhelpful a lot of the time because they just talk about how you can label a movieclip as a class from the "authoring environment". Real Helpful. But I get that now.

Other than doing the data scan and calling the pings, I'm running into this one error.

Code from my stage:

var house1:MovieClip = new House();
addChild(house1);

var pLife1:MovieClip = new pinglife();

And all of that works fine and dandy. The movieclip pinglife is this simple little icon that fades in and then fades out, and then I have this code(on the final frame) to try to get rid of the MovieClip:

parent.removeChild(this);

This also seems to work fine, however now it gives me this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at pinglife/::frame45()

Frame 45 is the frame on which I have that removeChild() code. I'm confused as to how I can solve this error, or if I even need to.

Also, question about object oriented programming in AS3. I'll eventually program some methods for my house class to make calling a ping event much smoother-- Do i define these methods somewhere on my stage, or on the first frame of the House movieclip? Or do I put it in the constructor of the class? Where should I put my constructor? First frame of the movieclip, or somewhere at the stage level?

Thanks a bunch!

Response to: Big Project, Need help. Posted February 1st, 2009 in Game Development

Okay, this is embarrassing: I can't figure out how to instantiate new objects nor get the actionscript within a movieclip to kill itself off after a certain time. Is there some way for a parent movieclip to be able to instantiate a movieclip at a relative location to itself? Are there any way to feed movieclips certain instantiation variables or something so I can run one line of code that sets up the entire ping? Something like this.parent###.addChild(ping, x, y, textToDisplay)? Coming from a Python background, I've been looking for something like __init__ settings and not gotten many results.
Any help is appreciated, Thanks.

Response to: Big Project, Need help. Posted January 29th, 2009 in Game Development

At 1/29/09 02:03 AM, Fion wrote: I'll get the ball rolling for you, flash cannot read excel files so you will need something between flash and the excel file to interpret for you, PHP and text files could do the trick.

Ahh, thank you! This is really good to know. I can probably use excel to create the AS code that will hold the data in the flash file. It's non-essential that I have flash access an excel file, as I don't really need this to be portable or access anything dynamically.

Response to: Big Project, Need help. Posted January 29th, 2009 in Game Development

At 1/29/09 03:02 AM, ThePeasant wrote: oh God... I messed up something else too... dumb tiredness. Damnit, I hate not being able to edit my post!

Alright, scratch the previous code. This one's fixed up:

Awesome! I think this is exactly what I need for my highest-level code!

The next step is the sub functions. I think if I have an animation of the ping with dynamic text in it, I can instantiate the movie-clip using actionscript, right? In order to get the pings to work right, I was thinking of having them be called by a parent object, and have each parent be called by the highest-level code.

This way I can have those parent objects scattered on their correct respective places on the map, and then have each parent object micro-manage the distribution of pings if a zone gets hit more than once.

Am I headed in the right direction? Or is there a more appropriate way to do this in flash?

Thanks.

Response to: Big Project, Need help. Posted January 29th, 2009 in Game Development

Heaven forbid I attempt to draw upon the collective knowledge of a small community of intelligent people.

Big Project, Need help. Posted January 28th, 2009 in Game Development

Hey Newgrounds,
I need to accomplish a bit of a data visualization project, and I think flash might be perfect for it!
Problem is, I don't really know how to get a few things to work.

I need help:
1 Reading data from an excell file
2 Scanning through that data sequentially, one row at a time
3 Based on the data- sending a command to an object that represents a graphical location and then:
3.2 placing a ping on the map, with some information that would be in the same excell row.

As a programming project, this should be pretty straight forward with Object Oriented design-- every location I need pinged is an object that takes a command: Ping, with the paramaters or arguments of data found in the excel sheet.

My problem is, I have no idea how to get any of these parts to work. This project is a bit more than just "how to make a preloader" tutorial and the like, as the way I have it planned out requires one function scanning through the data, sending commands to other functions that call objects to appear and disappear onscreen. You can all imagine how difficult it is to try to find the information I need since most of the documentation is about how to solve very specific, and small problems ("make your own dress-up game", "how to create a side-scrolling shooter"...etc)

If anyone can direct me to something useful, like how to scan data from another file (or help in creating nested arrays/lists/whatever they're called in actionscript) and how to have functions call other functions, or have a function call something that will do a visual display, that would be awesome. Thanks.

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

Okay so, you can look at it yourself, the updated code: here's the input.php

<?php 
$name = htmlspecialchars($_POST['name']);
$age = (int)$_POST['age'];
?>

Hi <?php print("$name"); ?>.
You are <?php print("$age"); ?> years old.

spits back

Fatal error: Call to undefined function php print() in /home/a2857555/public_html/action 2.php on line 6

Note that the following code WORKS on this server:

<?
	$Today = date("1 F d, Y");
	
	$YourName = $_POST['YourName'];
	$CostOfLunch = $_POST['CostOfLunch'];
	$DaysBuyingLunch = $_POST['DaysBuyingLunch'];
?>

<html>
<head>
<title>Listing 1-5</title>
</head>
<body>

Today's date is:
<?
print("<h3> $Today</h3>\n");
print("$YourName, you will be out ");
print($CostOfLunch * $DaysBuyingLunch);
print(" dollars this week.<br>");


?>

</body>
</html>

Test it out at this page

I can't for the life of me figure out how the print statements are different.

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

At 7/16/08 05:06 PM, citricsquid wrote: You're telling the script to echo the variables, but they're not set.

$variable = $_POST['variable'];

So for "costOfLunch" you need to set "$costOfLunch" through the above set up, understand?

I use php5, but it should be the same.

New code with your suggestion:

<?php 
$name = htmlspecialchars($_POST['name']);
$age = (int)$_POST['age'];
?>

Hi <?php echo$name; ?>.
You are <?php echo $age; ?> years old.

Gives error message:
Parse error: syntax error, unexpected T_VARIABLE in /home/a2857555/public_html/action 2.php on line 6

Is echo bullshit?

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

Oh, and this might help figure out what's wrong.

Because that executes, I know that it isn't a problem with permissions or something... But if It were a problem with permissions, I wouldn't get that error message anyway.

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

Okay, I ran into a major road block with this book.
One of the things that has always killed me when I tried to pick up PHP (this isn't the first time) is the fact that in order to use it you need to install and configure a web server, mysql, and PHP.

I figured I would skip all of this by looking up some free webhost that offers php and mysql support.
Well.. Either there are glaringly obvious flaws between PHP4 and PHP5 that I can't seem to find, or this freehost is retarded.

Here's two scripts from the book. I'm just trying to do simple user input and php output.
Try it yourself at here.

<html>
<head>
<title>Listing 1-4</title>
</head>
<body>
<form action="1.5.php" method="post">
Your Name:
<input type="text" name="YourName"><br>
Cost of a Lunch:
<input type="text" name="CostOfLunch"><br>
Days Buying Lunch:
<input type="text" name="DaysBuyingLunch"><br>
<input type="submit" name="x" value="ComPute">
</form>
</body>
</html>

Now the 1.5.php that should spit everything back.

<?
	$Today = date("1 F d, Y");
?>

<html>
<head>
<title>Listing 1-5</title>
</head>
<body>

Today's date is:
<?
print("<h3> $Today</h3>\n");
print("$YourName, you will be out ");
print($CostOfLunch * $DaysBuyingLunch);
print(" dollars this week.<br>");


?>

</body>
</html>

It's pretty unsettling when a verbatim copy from the book does not work.

Here's the examples right from php.net

First the input file

<form action="action.php" method="post">
 <p>Your name: <input type="text" name="name" /></p>
 <p>Your age: <input type="text" name="age" /></p>
 <p><input type="submit" /></p>
</form>

and its output file.

Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.

All my friends are telling me to give up on PHP and just learn Ruby now.

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

I'm not getting rid of my book because, as elbekko earlier stated, the only difference is in OOP stuff. This means everything else in the book should be legit, or fairly legit, for PHP5, and I can just read the appropriate "Migrating from PHP4 to PHP5" and other articles.
I don't expect there to be any disadvantages in learning for a book that was written on PHP when only PHP4 was out because if the only major changes were in OOP, everything else should maintain similar syntax, right? This book should be completely sufficient, except for its few chapters on OOP, then.

I do understand the basics of OOP (at least with python) and I'm curious as to how it works into PHP and web applications, but then again I don't know enough about PHP and web applications in the first place, so I figure it's something I'll cover when I get to it.

At 7/16/08 06:40 AM, elbekko wrote: Bad advice, that. If you're going to learn something, learn it properly.

I do support learning something right the first time so as to avoid bad habits that are hard to break later, but do you still think there will be any major conflicts in learning from a book written when PHP4 was around if I skip sections dealing with OO and learn those elsewhere? Has the syntax changed in ways that would save me a lot of trouble, or are there functions that would break down if I used them the "old" way?

As I said, mostly the OO differs between PHP4 and PHP5. If you're not planning on using it, you're fine learning PHP4 for the moment, since it'll work on PHP5 anyway.
But if you want to use OO, and there are few good uses for OO in PHP, go for PHP5.

I think that I probably should plan on using it, as it lets you do a lot cooler stuff later on, and it's really a good design practice in general. But I have a quick question for you: What are some examples where OO has a great advantage over not using it in some specific problem/project? (I'm not looking for code, just the general idea, even if the comparison is just "this would take six times as much code because of ---")

At 7/16/08 09:13 AM, DougyTheFreshmaker wrote: I'm not sure where this 'which version' debate came from, but you should definitely learn the latest version, which PHP's site says is 5.

Once again, I agree. And I hope that this book's teaching of PHP4 is pretty much covering everything I need to know for PHP5, minus OOP that the book covers. No sense buying a new book when the old one covers everything but a few new details I can supplement elsewhere.

Thanks for all the attention, guys.

Response to: Is my old book on php4 useless? Posted July 16th, 2008 in Programming

I guess I'm dumb and should have just gone over to the documentation section of php.net in the first place, so I'm going to post my findings here.

First up: The overly obvious sounding "Migrating from PHP4 to PHP5" (god I'm retarded.)

Next, for the marginally less observant, and the people with more free time on their hands, the two sections: Classes and Objects (for PHP 4) and its partner Classes and Objects (for PHP 5)

Yeah..

Response to: Is my old book on php4 useless? Posted July 15th, 2008 in Programming

At 7/15/08 04:24 PM, elbekko wrote: OO has changed hugely. But for the rest, it's pretty much alike.

Thank you.

Is my old book on php4 useless? Posted July 15th, 2008 in Programming

I found this old book about learning PHP. The only problem is that it covers php4, and the current version is like what, php5 or something?

Will I be missing out on anything huge in learning from a book designed for php4? Have there been any drastic syntax changes or anything like that since then?

Thanks.

Response to: Learning Methods Posted July 15th, 2008 in Programming

At 7/14/08 04:53 AM, BoneIdol wrote: As for your learning method; don't know the proper name but it's essentially learning by doing and learning by example.

I'd say that's really close to what I'm after, but there's a slight difference. Learning by example is great and awesome in aiding in the instruction of how certain things in code work or how various concepts in programming work through demonstration. I often find myself confused when a function is defined in English in front of me because that doesn't always explain how it is used nor what it does in the end. Examples work wonders in clearing things like that up.

The key difference in what I'm trying to figure out is the part where you're assigned problems that you need to solve with what you know. This is tricky, because it's hard to assign something that can be solved one way without requiring knowledge the student has not learned yet or could be solved without using the newly learned topics. To challenge a person to come up with their own methods of incorporating new ideas is what truly solidifies newly-learned information and helps in applying it to unique problems.

But maybe I'm too lazy running around looking for this ideal method of learning and should just suck it up and brute force through a different way.

Thanks for the book reccomendation.

Anything online and free would be wonderful.

Learning Methods Posted July 14th, 2008 in Programming

I'm trying to figure out what this learning process is (described below) and if there are any sites out there with lessons based on that method in teaching php/mysql for building web applicaitons.

So I recently finished a Computer Science class at my college. They had this approach that was really effective which involved teaching a specific topic involving programing (like lists, or boolean conditions, or classes/objects) and then a proposed assignment which required the use of whatever topic was taught. For example, they taught us about how to use lists for various things and then had us write a program that had to animate multiple cars driving horizontally across the screen. They only taught us how lists worked and how to incorporate them into for loops, we had to use what they taught us to figure out how it could work for the assignment.

This combination of instruction and then creative discovery really worked well to solidify not only key concepts in programming, but also the process itself, which really helped.

I've been wanting to search the forums and the internet for this approach to programming, but I haven't been able to figure out what it's called. All sorts of "beginner's programming" documentation are all the same (Introduction, What are variables?, loops, boolean conditions, buy our book.... to name the order of most of the headings found in like every article out there).

Any ideas on finding the process I'm describing? Or any straight-up advice for where to go for learning php/mysql for web applications (I'm sure there's billions out there, with all this web2.0 crap) for someone who knows at least the basics to programming?

Thanks.

Response to: Platform Discussion, Sans Biases! Posted August 8th, 2007 in Programming

At 8/8/07 01:51 AM, DFox wrote: AUGH, you make me want to cry. You just wrote two paragraphs in response to me, but you've yet to contribute ANYTHING to your own topic. Nada.

I must apologize. I didn't realize I was here for your own amusement.

Linux: Linux is arguably the most stable of the three leading operating systems, but it does have its own inherent problems. Coming in numerous flavors, the Linux community has a lot to offer, however with so many choices new users wishing to try Linux out may be overwhelmed. Ubuntu, Red Hat, Suse, Gentoo, Debian, and more all cater to different tastes. Linux's steep learning curve is its major flaw, along with few game and hardware vendors supporting the platform. Sure, there are games that will run on Linux, and there are ways to hack other drivers to get some hardware to work, and of course there are numerous opensource alternatives to many of what you would need on a windows or macintosh machine, but there is still a lot of work to be done.

Windows: Windows holds the majority of the market share. It's offered by default as the bundled OS from all of the big players in the PC Market: Dell, HP, Toshiba, Sony, Alienware... the list goes on. But out of the three, in its current state, Windows is easily the least stable. An advantage of using Windows in lieu of other operating systems is that it is the most popular one. This means that you not only get the benefit of the most available drivers for more varieties of hardware, but also more software, free and commercial, and of course, more games. Windows is, hands down, the target operating system for nearly every game developer (outside of console developers). But, Windows' advantage is also a part of its own downfall. In being so popular, the system is the number one target for people wishing to break into computers for personal gain.

Macintosh: Having a history of being the most unstable, and least useful operating system for a number of years, OS X has risen to different standards. Being based upon Unix, it is nearly, if not completely as stable as Linux operating systems. But, it is also far more user friendly. The learning curve of OS X is far shallower than Linux or Windows. In addition to that, it's as customizable as Linux in terms of shell scripting and other tasks. The major downfall with OS X is the fact that in order to run it, you need to buy a computer directly from Apple, and they're not exactly on the cheap end of computing. And, in addition to that, there is less freeware for OS X than for Windows, though there are a number of opensource projects which support the platform. Oh yeah.. and a considerably smaller number of game developers program games for OS X than for Windows, but such a small market share can tend to do that.

Now, color the flower red.

Platform Discussion, Sans Biases!

Response to: Still haven't embraced RSS Posted August 8th, 2007 in General

RSS certainly can't make me a sandwich. That's for sure.

I mean, I could subscribe, through the magic of RSS, to a blog about making sandwiches. So then I would be delivered page after page about different sandwiches to make. But it wouldn't really be any different from me just visiting the sandwich site anyway.

Am I really too busy to type kama-sutra-of-sandwiches.tld and look up delicious sandwich recipies myself? Probably not.

And I'm still hungry after I read all the recipes one way or the other.

Who's going to make me a sandwich?

Response to: Platform Discussion, Sans Biases! Posted August 8th, 2007 in Programming

At 8/8/07 01:11 AM, DFox wrote: This topic starter said "talk about this stuff" and then instead of kicking off the topic in style, gave the "go" command. It's not the people's replying job to find something to discuss. It's the topic starter's job. My underlining point is at least Rusty provided a topic that could spawn actual discussion, contrary to this topic. It's like the same thing as me making a topic now, and saying "talk about PHP. Go!". It's just stupid.

I really just wanted an open discussion where the means of a topic involved just measuring up the various platforms against one another. Intentionally steering the topic to something as specific as, lets say.. "Which is better for games?" or perhaps "Which system has a more expandable API?" or even the tired old "Which one is more stable?" would limit all discussions to only that narrow topic. As I am sure we can all agree, there are far more means to evaluate a system than merely based upon it's ability to play WoW. Though the broad question of "Which is better?", while direct and to the point, invites petty arguments laden with bias; comments frequent among fan boys on any side of the debate. And so I invited everyone to simply discuss the differences, the advantages, the disadvantages, and whatever else would come to mind. I was hoping for a more objective discussion, and tried to reinforce this by asking everyone to evaluate their own biases before posting.

And then to top it all off, the topic starter says "without having their comments jaded by prejudice" which translates to no expressing your opinion, because without prejudice, there are no opinions.

That is to say, there would be no opinions laden with personal bias. Yes, opinions are subjective in nature, but your sense of subjective reality can be based upon biases, or they can be based upon arguments and ideas well supported by facts.

Yes we all have our biases here and there, but I'm uninterested in hearing another "macs are for fags" argument.

Platform Discussion, Sans Biases! Posted August 8th, 2007 in Programming

Hey, I dare the computing community of NG to have a discussion of the three leading operating systems without having their comments jaded by prejudice.
OS X, Linux, Windows.

Go!

Still haven't embraced RSS Posted August 8th, 2007 in General

So I still haven't started using RSS for anything. Is this a big deal? How lazy does a person have to get for them to need their content aggregated right to their computer?

Response to: Harry Potter Posted July 21st, 2007 in General

*SPOILER ALERT*

Harry brings Dumbledore back to life and then he dies again!

After getting Herminone preggers!

Biggest, most intricate plot twist in the history of English literature, OMG!

Response to: I have a confession Posted July 21st, 2007 in General

Eat laxatives like candy.

Sweet poop candy.
Response to: How the fuck do you play this game? Posted July 21st, 2007 in General

I unlocked Deadly Ninja Mode.

Response to: A Period of Time Posted July 21st, 2007 in General

Miss registration deadline.

Response to: This can`t be good... Posted July 21st, 2007 in General

What program is that?? It takes serious *balls* to write a program to deal with integers that big.

Response to: What is the Worst Shock-Site? Posted July 21st, 2007 in General

Upon reviewing the relevant content, I must elaborate.

While Goatse is obviously the best shock site, Pain Olympics is by far the most disturbing. Jesus Christ.

Response to: What is the Worst Shock-Site? Posted July 21st, 2007 in General

At 7/21/07 04:34 AM, Twist-Chao06 wrote: People Say Meatspin is the worst shock site. Or Pain Olympics. or even Lemon Party. But Goatse was The All-Time worst.

If by worst you mean, of course, BEST shock site.

Goatse is, by far, the best shock site. It touches you on a philosophical level which makes you question your own moral fiber.

Response to: on some Posted July 21st, 2007 in General

At 7/21/07 03:39 AM, Daimonas wrote: bloopers for a cast tryout this charecter said something and the guy that was trying out stood there for about 30 secs and sid i just made a piss in my pants.

My Word! If it were ever to occur to a mind, in such a troublingly dreary era of times such as these, when it may or may not be so appropriate to ramble on at some such length about the half moment inwhich the said ruffian were to find a player enamored with such an awful spell of stage-fright so as to leave the player, or rather: would be player, petrified with terror, then these forums of insightful discussion would be ever so much more unladen with such pitiful scum.

on some

Response to: irony... Posted July 21st, 2007 in Politics

How long has it been since Youtube wasn't a reliable source for citing points in one's argument?

And when can I leave footnotes in an essay linking to Youtube?