3,804 Forum Posts by "Sam"
Legit though, if you still need it, my Chinese friend only just got back to me: 旧回忆
At 5/17/14 10:03 PM, dovahkhiin1994 wrote: Something I find really dumb with this site, is the fact they don't allow discussion of actionscript in the programming forum, just because it is affiliated with flash. Stupid rule in my opinion, considering actionscript IS a programming language. Anyways, if you wish to learn actionscript, but never programmed in your life before, I recommend that you learn to program from a more basic language. It's called Python, and it is a very beginner friendly language to learn. IT'll help you understand the fundamentals of programming, and it will help you move on to languages such as Java, C++, and hell even Actionscript.
It's a legacy thing, back when programming outside the Flash IDE was rare. Python is a fine language choice, but its syntax is in a unique category. I don't think learning ActionScript as a first language is necessarily a bad thing, I find you can reap the rewards much more quickly than other setups.
I recommend starting with Java for that
I disagree in a lot of situations. If you plan to work anywhere, Java tends to be necessary, but from a hobbyists point of view I don't think it's a good second language choice or a good language choice at all for that matter.
since C++ is much tougher IMO to learn. Basically, you want to do this, so you can build on your fundamental knowledge of programming. You'll be surprised on how much more sense actionscript will make once you try it again after a few months of self discipline.
I'm struggling to find a reason for this thread. Are you just saying that Python is a better first choice language than ActionScript? Is it not the case that learning any language first means other languages make more sense?
If self discipline is what you're after, then why not just go for C++ first and learn the woes of pointers, memory allocation and cryptic debugging? After that, plenty of languages seem to make more sense and are much less tasking on the programmer.
At the end of the day, it's down to what somebody wants to create. When people say "I just want to learn to program", there's always an underlying motive and end goal. They might want to: make flash games, general software, mobile applications or websites; become a hacker or a hundred other things.
As a general first language, I completely agree that Python is a great choice. But if somebody wants to make Flash content, then I see no reason to pick Python before ActionScript.
At 5/17/14 11:16 PM, evowolfdemon wrote: How can i create a half circle hp bar for my characters health. I tried looking on google but not much comes up about making half circle hp bars.
It depends how you want to do it. Do you want to do it completely with code or as graphics that you then manipulate with code?
Actually, it doesn't really matter if you separate the logic from the graphics. Build a class which has 3 different states: full, half, empty which change the graphics accordingly - whether that be graphics drawn by code, loaded bitmap graphics or vector graphics from an SWC. From here, you could store instances of the class in an array based on how much health the player has, and based on whatever the condition is to lose health (e.g. one hit causes half a life to be lost) you can loop the array and find the next non-empty instance of your class and change its state with some method.
Alternatively, you can go the extremely static (and not recommended by me) way, where the first frame has all health filled, the second frame has half of a life missing, the third with a whole life missing etc. Then you can just increment the frame with a nextFrame() command.
You have the x, y, width and height. They might conform to some grid in a "tile" kind of way, but they might not, and it actually doesn't matter. You can use standard box collisions to check if a collision occurs. Here's a pretty quick and informative video on it.
Resolving that collision is as simple as moving the object(s) in the opposite direction they were moving until the collision isn't happening any more.
Alternatively (or additionally, in certain cases), you can pre-emptively check if a collision will occur if the object were to move as much as it wants to. If a collision would happen after the movement, just don't allow it to move at all, or move it as much as it can without colliding.
At 5/8/14 02:57 PM, Rustygames wrote: Sam is a wonderful programmer, you'd do very well to team up with him.
Thanks for the kind words!
At 5/8/14 03:51 PM, milchreis wrote: The same thing applies.
Didn't see your post, my bad!
While I thought I had this problem before, I just set this up to test it. Is this a scenario where the problem should occur - because for me, the mouse over event fires fine.
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
var t:Timer = new Timer(3000, 1);
t.start();
t.addEventListener(TimerEvent.TIMER_COMPLETE, showSpr);
}
private function showSpr(e:TimerEvent):void
{
var spr:Sprite = new Sprite();
spr.graphics.beginFill(0x000000);
spr.graphics.drawCircle(0, 0, 50);
spr.x = 250;
spr.y = 250;
addChild(spr);
spr.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
spr.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
}
private function mouseOut(e:MouseEvent):void
{
e.currentTarget.scaleX = e.currentTarget.scaleY = 1;
e.currentTarget.alpha = 1;
}
private function mouseOver(e:MouseEvent):void
{
e.currentTarget.scaleX = e.currentTarget.scaleY = 1.2;
e.currentTarget.alpha = 0.5;
}
}
At 5/7/14 04:41 PM, GeoKureli wrote: I wonder if the second test would increase if the point is within the rect bounds of the parent shape, but outside the shape bounds.
I meant not in the display object as: obj.hitTestPoint would return false and length of obj.getObjectsUnderPoint would be 0. If that's what you were referring to.
The tests were just simply:
obj.hitTestPoint(0, 0)
obj.hitTestPoint(500, 500)
obj.getObjectsUnderPoint(new Point(0, 0))
obj.getObjectsUnderPoint(new Point(500, 500))
Where 0, 0 would return true/length > 0 and 500, 500 would return false/length = 0.
Point is in the display object (10,000,000 runs):
obj.hitTestPoint = 3835 ms
obj.getObjectsUnderPoint = 19651 ms
Point is not in the display object (10,000,000 runs):
obj.hitTestPoint = 3778 ms
obj.getObjectsUnderPoint = 17368 ms
Did a quick benchmark!
At 5/5/14 10:55 AM, neonpaint wrote: Well, I suppose AS3 could work too, it's just that I personally find it more difficult! So, yeah, AS3 too!
You won't be the one writing it, hence why you posted this thread.
It'd be a good idea to give some more background into the project so that programmers now what they're getting into. The more info, the better!
This link is directly from their website and is a zip of the master branch from their github.
ActionScript related threads belong in the Flash Forum.
At 5/4/14 12:19 AM, Acid wrote:At 4/27/14 08:43 PM, many-monkeys wrote: I know nothing about programming.whatever you do start at code academy http://www.codecademy.com/
Wheres a good resource to learn about this stuff from a total noob.
While I think Code Academy (or apparently Codecademy, now?) has good intentions, I feel it can't exactly beat just jumping straight into a language. And because development enviroments are easy to set up, I see no massive advantages to Codecademy. I should mention that I've only used it briefly, though.
If you want to learn web design: w3schools.com
Uh-oh! @Diki might have more to say on this topic though.
learn the languages in this order: html -> css -> javascript
Agreed. It tends to be a good path of learning for the web.
if you want to learn how to make software: http://docs.oracle.com/javase/tutorial/
I recommend starting with java. It is one of the most widely used, it is very reusable, and it handles some things for you that a new user wouldn't understand like memory allocation. If you want to switch to another language later you will pick it up quickly. C was the second language I learned and it took me half the time java did (I find it more straightforward than java, but I wouldn't recommend it as a first language)
Obviously this topic is subjective, but I won't go into why I don't think Java is a good first language.
If you want to learn scripting and automating tasks: first I would recommend learning basics on how to use command prompt, then how to make batch scripts, then take that knowledge and apply it to powershell.
Batch scripts are generally useful to know but I don't think it's a necessary skill.
If you're just looking for a general-purpose language that is easy for a first-timer to learn then I highly recommend Python.
Python is also a very good language to learn for scripting.
Another vote for Python here. Gets you up and running, you can reap the rewards early on and it allows you to do a lot.
I'm revising Haskell for my exams, and I just realised what a nice language it is. I don't actually know how to do anything useful with it because my exam is more about operations on lists and creating type constructors and whatever whatever - but it's still really nice to read and write.
or maybe because it's the only thing I've looked at for the past week. Also, bump
At 4/30/14 03:17 PM, Sam wrote:At 4/30/14 02:48 PM, AnteHero wrote: Does anyone know how to implement globalToLocal and localToGlobal functions manually?You need to get the objects position relational to its parent, add this to its parents relation to its parent and so on until some common ancestor of all of your display objects is reached.
I've written my own displayObject class which doesn't extend DisplayObject and really need these functions implemented.
My bad, skim read your post. That should be localToGlobal if I'm not mistaken. While I've never had to use globalToLocal, I'd have to assume it's exactly the same but reversed. Take some point in the global scope, a solution to getting that point local to an object (I think) would be to: localToGlobal your objects position, find the difference between the point you want to localise and the objects global position.
I might be way off mark though.
At 4/30/14 02:48 PM, AnteHero wrote: Does anyone know how to implement globalToLocal and localToGlobal functions manually?
I've written my own displayObject class which doesn't extend DisplayObject and really need these functions implemented.
You need to get the objects position relational to its parent, add this to its parents relation to its parent and so on until some common ancestor of all of your display objects is reached.
If you cuddle, I h8 u
At 4/28/14 06:01 PM, Sam wrote: You can use code tags to preserve formatting and make code excerpts easier to read, by the way.
I have no idea why I thought you didn't use code tags. I'm losing it.
At 4/28/14 05:48 PM, Lewchador wrote: I have a quick question. Is it worth doing single line if statements like:
if (!Key.keyHeld(Keyboard.LEFT) && !Key.keyHeld(Keyboard.RIGHT)) this.speed.x *= .9;
or is it better to do:
if (!Key.keyHeld(Keyboard.LEFT) && !Key.keyHeld(Keyboard.RIGHT))
{
this.speed.x *= .9;
}
The only difference would be the appearance correct?
It'll technically reduce the size of the file but aside from that it's personal preference. I'm lazy and quite often if I reckon it'll only be one line I do:
if(condition)
// code
You can use code tags to preserve formatting and make code excerpts easier to read, by the way.
At 4/26/14 10:49 PM, MintPaw wrote: So there's two questions really.
1. Using Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE; doesn't work in browser, even though it's in a function called by a MouseEvent. Why is this?
Is your target Flash and it's embedded with HTML or you're targeting HTML5? If it's the latter, it's most likely due to the infancy of the OpenFL HTML5 backend - it seems to have a lot of stuff missing at the moment.
Hope your LD project went well either way!
At 4/24/14 10:02 AM, aeoxeternal wrote: Yeah, it's for flash, but I'd rather not use AS. Which language do you think I should start with? I've heard that C++ is a very hard language to jump into, so should I start with something easier, like XNA? Or do you think C++ would be sufficient enough to learn for a beginner? I would love to learn programming and do it myself.
Thanks so much for the help and response!
So the graphics were done in Flash but you don't want to use ActionScript to program your game?
C++ isn't necessarily a difficult language, but it's easy to mess things up in my opinion. The only C++ game development I've had experience with is with the Allegro library (which was... usable, for lack of a better word). But no language or library is out of your reach if you put enough time and effort into learning it.
As far as I know, Microsoft haven't touched XNA for 3 years. A better bet - after some quick research - would be MonoGame which is the open source port of XNA to Mono.
The benefit I see as a Flash graphics designer and animator with using ActionScript (and therefore the Flash platform, or cross-platform if you decide to publish for AIR) is that you don't /have/ to generate and manipulate spritesheets to get your graphics and animations on screen. As an out of the gate programmer, you'll see results much faster which is often helpful.
I also feel compelled to mention haXe and OpenFL. One of its advantages it likes to boast is its similarity to ActionScript and therefore the ease of transition for ActionScript developers, but as you're new to programming, that's a void point.
Finally, one of the mods here is building a game called Concerned Joe in Lua with the help of the LÖVE engine. From their devblog, they seem to be steaming ahead with development, but I haven't used Lua or LÖVE extensively enough to make a comment on it.
Hopefully there are a few starting points there and you can do some research and find what's best for you.
Jesus, if this is the response new-comers get from these forums then it doesn't surprise me it hasn't been as active recently.
@aeoxeternal, what sort of programmer are you looking for? I have an inkling it's for a Flash (AS2 or AS3) game. If that's the case, this should be posted in the Flash forum. Additionally, you can make use of NewGrounds collaboration section.
In any case, fleshing your idea out is a good start while waiting for responses from programmers. Get as many parts of the game figured out as you can, keep drawing, keep planning, so when you come to present it to whoever you're collaborating with, they understand your idea as much as possible. As this is a programming forum, I also have to mention the option of learning to program (it's fun, I swear!). Learn the basics of programming in whatever language you want, put this idea on the sidelines and aim for something ridiculously simple to accomplish. With each project you finish, you'll learn something new and eventually this game will be in your programming grasp.
Good luck!
Ethical views aside: if you have the resources to target many platforms and you don't; you're doing it wrong.
At 4/14/14 05:44 AM, Rustygames wrote: Wow 20x??!!?
I assumed it would be higher (because iOS users obviously have money to burn) but not that much higher! Have you got a source on this?
Partly due to it being a lot easier to download apps for Android and install them not from the Play Store.
You haven't solved the root problem. You also don't need separate enterFrames, just have the one. Additionally, use code tags to preserve formatting.
speed = 3;
onClipEvent(enterFrame)
{
if(Math.abs(player.x - x) > speed)
{
// move x
}
}
I haven't touched AS2 in a long time, so this code won't just work by copy and paste. By subtracting the x's of the two objects and absoluting the value (gets the amount from 0, makes negative into positive in practice) we can tell how far apart they are. If it's greater than how much the object can move per frame, then move it. Otherwise, they're close enough. You can do an else and snap it to the x of the player if you want to here, or whatever you want to do when their x's are close enough to be considered equal by your game.
As I try to tell everybody using AS2, move to AS3!
Just check if the enemy is within 3 pixels before you do the move. If he is, don't bother moving it. You could also just add a margin of 3 pixels (the amount you're moving it by) to your if statements.
I've not done much in terms of programming recently because I have exams approaching way too quickly, but I've been trying to build a little framework to use. It's heavily influenced in terms of structure and naming by Flixel right now (it'll more than likely change as I work on it more), but there are a lot of things I didn't like with Flixel. So far all I have is drawing, state management, some "low level" classes and key input implemented but I'm happy with how it's working.
I'm not usually one for reinventing the wheel, but it's been fun to write. It's given me a chance to benchmark some stuff and learn the ins and outs of Haxe a little better.
At 4/13/14 07:46 AM, slugrail wrote: if (false <= true) {
// attack
}
NEXT LEVEL
// attack
At 4/10/14 12:34 PM, GeoKureli wrote: for(i in 0...100; i+=2)
Sorry for the double post, but I quite like:
for(i in 0...2...100)
At 4/10/14 12:34 PM, GeoKureli wrote: You mean like this:
public function getX():Number { return _x; }
Yeah, exactly.
If it's any consolation, property-like getters are overused by bad programmers, sometime you need that parenthesis to say "Hey there's more going on here, don't treat me like a variable"
I suppose, but using the getters and setter syntax with the variable function visibility (is that even a correct way of describing it?) is still something I should be conforming to I think. It irks me a lot when getters and setters are written and all they do is return or set with no other logic - I see no value to it, it just creates lots of redundant methods. It must have been a practice taught by my lecturers in one of their Java lectures because when working with people on my course, they all do it.
It's just lame, one of the main benefits of encapsulation is not having every private variable pop up when I type 'this.' in a derived class.
This. I thought FD was bugging out when it was showing my private definitions in the subclasses. It was only when I tried to write "protected" I realised it wasn't used in Haxe.
why not just:
for (i in 0...100) if (i % 2 == 0) {
do stuff to evens
}
Well, considering the original array was just the index multiplied by 2 and was scoped to the loop, you could halve the loops and multiple i, right?
Obviously the example was showing more than that from MSGhero but you know...
Also, I just realised I was typing Haxe like "haXe". Am I going mad or was it previously stylised like that?

