Be a Supporter!
Response to: Is it a good practice? Posted October 6th, 2014 in Game Development

Store it however you want, though a lot of people seem to prefer JSON to XML recently.

Whether it's good practice - I'm not sure what you mean. You're just storing volatile data, whether it's in XML or your own format is irrelevant.

Response to: Send info between classes Posted October 6th, 2014 in Game Development

You should have a class for each weapon, instead.

Response to: The Flash 'Reg' Lounge Posted October 5th, 2014 in Game Development

At 10/5/14 06:03 PM, MSGhero wrote: It makes php not shit according to Sam.

As long as I'm not writing in PHP.

Although there are some nice libraries that make it tolerable - a language shouldn't need libraries to pick up the pieces, come on PHP devs
Response to: The Flash 'Reg' Lounge Posted October 5th, 2014 in Game Development

At 10/5/14 06:43 AM, Rustygames wrote: Really? I think IntelliJ is the best. If not that then Eclipse (FDT for flash) or Flash Builder. Flash develop is always a last resort for me because it's so lacking in features that I take for granted in the others I mentioned.

IntelliJ's IDEs are great but a bit of a memory hog. For some reason I use them for everything but Haxe and AS3, but I might have to set up a workflow cause I seriously love them.

Response to: Html/js Vcam? Posted October 2nd, 2014 in Programming

At 10/1/14 10:17 AM, stickman8190 wrote: You know in ActionScript people would use a vcam for games to make it follow objects and stuff.

Any programmer worth their salt wouldn't use "VCam" for games.

How would you do it in Javascript with the canvas?

If you can manipulate the position of objects then you can create the illusion of a camera by moving things in the opposite direction to whichever way the target is supposed to be moving.

Response to: Object Level vs Document Level undo Posted October 1st, 2014 in Game Development

Imagine this chain of events:

1) Draw straight into the document
2) Select the drawing
3) Convert to movieclip
4) Double click the movieclip to edit it
5) Draw some more inside that movieclip
6) Draw even more

Document level undo will trace back your steps all the way to 1, while object level undo will only undo changes made to that object (i.e. the furthest you can undo is 5).

Response to: If command with two conditions? Posted September 28th, 2014 in Game Development

At 9/28/14 07:43 AM, GrahamNG wrote: Right, so I want something to happens when two conditions are met.

Something like:

if (11 + 4 == 15 also 13 + 6 == 19){
somethingHappens
}

You want to take a look at operators

if(this && that)
    // both are true

if(this || that)
    // one or both are true
Response to: The Flash 'Reg' Lounge Posted September 27th, 2014 in Game Development

At 9/26/14 08:08 PM, yoloswag69 wrote: I misread what you were trying to ask. Angular is not important in this context, it's just a clientside library.

Well, it was the initial point. "Can I even make it secure if all the dev is using is a client side library". I was too stuck in the mindset of "make it as easy as possible for anybody", but it boils down to them needing a backend to hide the request to the API from the user of their application, regardless of what authentication method I use (key or user/pass or whatever)

At 9/26/14 05:24 PM, knugen wrote: In regards to the devs using your API: they should route the API call through their own backend, making the actual API call go from server to server.

Is basically what it came down to.

Response to: The Flash 'Reg' Lounge Posted September 26th, 2014 in Game Development

At 9/26/14 09:53 AM, yoloswag69 wrote: The key is called "cookies". When you emit a "Set-Cookie" header browsers will automatically pass that variable back to your server.

You're right that HTTP can always be intercepted, because you would have to use math tricks to share a key with a server in a way that can't be intercepted. Fortunately this stuff is also automatically handled by servers and browsers: secure connections.

If you're using a service like Heroku or Azure to host your server , you can just change the URL to "https:" and a secure connection will be used. Now your interchange is not interceptable.

I'm not sure I fully understand. To store a cookie I need to run some client side JavaScript, which is just vulnerable, no?

My imaginary API worked like this: devs sign up, are given a key, that key is used to allow them to access only data specific to that key. I had no idea what this "API" would do (i.e. what data I was going to store), only the way devs would interact with it.

The problem was that in an Angular app, all requests are made "client-side". So if you make the request in Angular via the http module:

$http({url: "samsgreatapiurl/somethingelse", method: "GET", key: "my dev key"})

The devs server does none of the requesting, no preprocessing is done, so the key is essentially plain text to any user of the app.

I spoke with a developer at work and the solution we came up with this. As a dev and user of my super cool API, you can either:

Inject the key into the request via something like an Apache module or run some server script to route the requests, and add the key there.

It shouldn't be my concern if the developers adequately secure their key.

Response to: The Flash 'Reg' Lounge Posted September 25th, 2014 in Game Development

At 9/20/14 04:14 PM, Sam wrote: How the fuck do I secure my API?

The answer is: you don't.

Response to: The Flash 'Reg' Lounge Posted September 20th, 2014 in Game Development

Posting in a thread about communicating across domains, it's got me wondering about authentication.

I've been giving AngularJS a go, and I'm attempting to build a RESTful API to expose my data. I'm obviously building this API as if any developer can use it, AngularJS is just what I want to use to build a "web app".

How the fuck do I secure my API?

If I were building a website "conventionally", my website's server would make the requests to the API using some key, process the data and spit out the view for the user. The key is never exposed publicly so there's no risk of someone taking that key and using it to make malicious requests to the API.

But, using Angular, all the means of getting data is passed to the client and the client executes it and displays it and whatever. So if I were to use a key, they could sniff the traffic and see it clear as day in the request. If I encrypt the key then they can still just use that because I'd have to decrypt it on the other end anyway.

I feel like I'm missing something here, but I think this is an interesting topic so let's have a chat.

Response to: Swf Files And Php Trouble Posted September 20th, 2014 in Game Development

At 9/20/14 03:13 PM, coderchick94 wrote: Would that be a good idea or is it foolish?

If your application (which I assume is a game) gets popular, then sites that rip the SWF and host it on their site won't be able to use it.

Unfortunately this isn't my strong suit, but something I'm interested in so maybe another user can give some information on the best way to secure it.

Response to: Swf Files And Php Trouble Posted September 20th, 2014 in Game Development

At 9/20/14 02:34 PM, coderchick94 wrote: The php is taking an array, stringifying it, storing it to one PHP file which stores it in an SQL database <- Save Btn
And another one that retrieves the array from the SQL database, and returns it back to flash <- Load Btn
This works perfectly. I tried it when I had the swf file in the same folder (on the server) as the php files and it worked perfectly, which is why I think that's the problem.

If you put your PHP file on a different server to your database, you'll have exactly the same issue.

Your problem isn't with your AS3 code, because as you said, it worked fine when the PHP and SWF were on the same server. The problem is that you can't just go around requesting data from servers unless they allow it.

In AS3, you have to first request an XML file from the server you want to talk to:

Security.loadPolicyFile("mydomain/crossdomain.xml");

On your server, you then need a file, which may something like this:

<?xml version="1.0" ?>

<cross-domain-policy>
    <allow-access-from domain="*" />
</cross-domain-policy>

However, I hope you can see how dangerous this can be. The wildcard (*) means anyone from any server can make requests to your server. This is fine for when you're testing, but when you deploy your application you need to either:

Only allow access from the domain the application is hosted on.
If you trust the domain then this is a fine approach, but it means your application can't be distributed to other sites as SWFs often are.

Add authentication
Allow access from domains, but when they access your data via your exposed URIs (/get, /post, /scores, /data or whatever yours are called) require some sort of authentication. This can be through a shared key or a username and password.

Response to: Swf Files And Php Trouble Posted September 20th, 2014 in Game Development

It's most likely issues on your server not allowing requests from domains it doesn't recognise, with Apache configured servers, I know you can modify this through the httpd.conf. I think this is related but my knowledge doesn't go very far with this kind of thing.

At 9/20/14 01:44 PM, coderchick94 wrote: I guess the thing I'm really asking is can newgrounds store. php files so I have the .swf file interact with an external server?

What is your PHP doing? I'm confused as to what you're actually processing with your PHP if you have no problem with it being put on some random server.

Response to: The Flash 'Reg' Lounge Posted September 11th, 2014 in Game Development

At 9/11/14 02:17 PM, Rustygames wrote: There are tonnes of books that do that though. I don't know if enough people will read it to be worth our time :(

I doubt many of the people who post here are reading those books. I feel like having a resource directly on Newgrounds would benefit a lot of people and stop these ridiculous threads.

At 9/11/14 02:21 PM, egg82 wrote: sure, but how do we do that without turning it into AS:Main? Like, how's all that going to work?

I feel like AS: Main had a lot of specific stuff that wasn't really necessary. There should be language essentials and programming concepts and then let people figure out how to use these things to build the things they want.

Response to: The Flash 'Reg' Lounge Posted September 11th, 2014 in Game Development

We need an AS: Main-esque thing that starts with the basics and brings in new concepts in AS3 where each chapter is written by a different reg.

The amount of inexperienced knowledge floating about is horrendous.

Share the knowledge, boys.
Response to: Let's Talk About the NG Layout! Posted September 7th, 2014 in NG News

At 9/5/14 02:05 PM, TomFulp wrote: For the past few years we've been watching the web evolve around mobile and have been planning for NG's ultimate evolution as well.

In addition to a layout that can function well on mobile, we have received very well-informed feedback about the importance of slimming down the NG header for maximum content visibility in traditional browsers. The current layout may compete too much with the content, which is the most important part of NG.

Check out this rough slim header concept.

Artists, UI designers and NG fans, I'd love any feedback and mockups you want to make in response to this. Please read the notes below:

1) The top left has a menu button, increasingly common in modern design for both mobile and web. This would be how our menu is accessed via mobile but is it going too far for web browsers? Are we hiding our awesome content categories and requiring too many clicks? There are trade-offs we could make; for example, users could have the option to PIN a persistent nav under the header. We could also include the nav on any page that is "owned" by NG, such as the front page and individual hubs, whereas content pages and user pages are owned by the individual user and we wouldn't compete with them for attention.

From a UX point of view, I think having a persistent nav on desktop for all users is better - less clicks to get where I want to go. On mobile though, screen real estate and content delivery takes higher precedence.

3) The Upload button is a BIG ONE. In the current design, the header has buttons for Dumping Grounds and the Project System; most people don't have a clue what those buttons are. The upload button would open this menu, providing users with more clear options as well as educating them about the files we accept (many animators and devs still think we are SWF-exclusive). Note: This could be prettier looking.

I'm not a fan of the drop down, particularly the colours of the buttons.

Does audio, art and movies go through the project system before submission? I've only ever worked on games when it's been in place so I'm not sure. If they don't, I feel they should. It'll create a unified process to submitting to NG.

"Your projects" and "Your file dump" should be under the "your profile" button imo - they're linked to a user.

6) Far right is your profile, which could show your user icon like we currently do. The big question here is whether we have one-click profile access like we do now, or if we have this button open a mini menu, like many sites do. The options on this menu would be PROFILE, SETTINGS, EARNINGS and LOG OUT. There are people that don't know they can click the gear to check their earnings, so this might be more clear.

Showing a mini menu would be good.

For further reference material here is the layout Luis was working on and an example of how it would collapse on mobile.

This looks ridiculously clean, but feel it's just a reskin and not a rethink of the overall layout and design.

Response to: The Flash 'Reg' Lounge Posted September 3rd, 2014 in Game Development

At 9/3/14 12:25 PM, Rustygames wrote: Like rewards me how? Makes my personal stuff more easy to find? But only my friends can see it right?

If you have Google+ links (or any social links for that matter) on your site you get ranked higher. I actually think Google+ is really nice, it's not too bad to navigate but they dumped so many features in it to begin with that it's a little overwhelming.

Response to: The Flash 'Reg' Lounge Posted September 3rd, 2014 in Game Development

Let's make Google+ popular.

Response to: Go to a random frame (AS2) Posted August 30th, 2014 in Game Development

At 8/30/14 07:14 AM, Sam wrote: This function rounds any decimal down. In the above case, it will return "5":

*following case

Response to: Go to a random frame (AS2) Posted August 30th, 2014 in Game Development

This function gives you a random decimal number been 0 and 1.

Math.random();

You can even use mathematical signs against the function:

Math.random()*100

This now gives you a number been 0 and 100 (Multiply 0 by 100, and 1 by 100)

This function rounds any decimal down. In the above case, it will return "5":

Math.floor(5.5);

And you should know gotoAndStop() and gotoAndPlay(). All these functions combined gives you the means to work it out yourself.

Good luck.

Response to: The Flash 'Reg' Lounge Posted August 30th, 2014 in Game Development

At 8/30/14 07:01 AM, Rustygames wrote: "Dear HR,

Metal Gear Solid Bamboo man is really good at the coding.

Sincerely,

Cowboy hat rusty person."

These names are so accurate, it's how I see both of you.

Response to: Looking for specific code? Posted August 25th, 2014 in Game Development

At 8/25/14 09:39 AM, GrahamNG wrote: I've noticed that opacity can go below 0, meaning my code is breakable, is there any syntax that would allow something like:

if (something.alpha ~equal to or under~ 0) {blah blah blah}
if(something.alpha <= 0)
{

}
Response to: The Flash 'Reg' Lounge Posted August 16th, 2014 in Game Development

At 8/16/14 04:22 PM, Luis wrote:
At 8/16/14 06:43 AM, Sam wrote: I will never be beaten.

3/29/12
FUCK YOU SAM.

O-ok

i mis u
Response to: The Flash 'Reg' Lounge Posted August 16th, 2014 in Game Development

I will never be beaten.

3/29/12

The Flash 'Reg' Lounge

Response to: How difficult would this be? Posted August 10th, 2014 in Programming

At 8/10/14 06:04 AM, SwisherCovent wrote: This would be a very achievable project for a beginner. File uploads and retrievals are trivial in PHP.

Agreed, it's a nice little project. It will teach you about form submission and interaction with a database via PHP along with using GET and POST.

Response to: [AS3] Multiple buttons error Posted August 10th, 2014 in Game Development

The extra "}" is a syntactical error, remove it and post the full errors you get when running it then.

Response to: MovementTest Posted August 10th, 2014 in Game Development

I feel like a running attack shouldn't stop his forward motion. The transition between walking and running happens far too quickly that it looks bad, maybe having a key to toggle running would work better.

Response to: Can someone help me with this AS3!! Posted August 10th, 2014 in Game Development

I assume you want the right and left buttons to cycle through the clips frames. Give your movieclip an instance name (doesn't matter what it is, I'll use myMovieclip). Give your buttons instance names (see if you can figure out what they are from the code), and this in the action panel of the frame:

myMovieclip.stop();

leftBtn.addEventListener(MouseEvent.CLICK, sendPrevFrame);
rightBtn.addEventListener(MouseEvent.CLICK, sendNextFrame);

function sendPrevFrame(e:MouseEvent):void
{
	myMovieclip.prevFrame();
}

function sendNextFrame(e:MouseEvent):void
{
	myMovieclip.nextFrame();
}
Response to: Idea behind controlling sound? Posted August 7th, 2014 in Game Development

At 8/7/14 08:39 AM, Barzona wrote: I'll check out the pastbin link you sent me when I get home from school. Chances are I'll wind up making a much more retarded version of sound control. I see your "Assets.getSound...". Looks like that's what i was considering before. I assume you're using that class for more than just music, right?

That's a Haxe class and method, which allows you to get resources for your game depending on the kind of file it is.

See, this is why being on a Mac sucks for me because I don't get to use FlashDevelop. I know there is no timeline on it, so it would force me to learn putting images together using code. that probably sounded really ignorant, but that is my current understanding.

You don't need FlashDevelop. I'm sure there a few Mac users here who have a workflow setup that doesn't use the Flash IDE. A quick google turns up FDT, an Eclipse plugin for Haxe and presumably AS3.

I've never seen Haxe before. it almost looks like CSS to me. Looks like you're also able to code for both mobile and desktop platforms. So, what, are you making a single game that changes functionality depending on if you're on a phone or a desktop?

It should look almost identical to AS3, it shares very little in common with CSS.

As far as I've tried, trying to scroll just moves the page. Even if it would've be able to do what I'd wanted, the page moving is undesirable. Maybe things work differently from the dumping grounds, though.

If the Flash object has focus, I think it catches the mouse scroll - although I'm not 100% sure.