|
Member
(05-28-2012, 10:58 PM)
|
#101
Hmm ok, I'll give it a try. It just seems lees intuitive than eclipse and java, which is my only experience with an IDE.
|
|
Member
(05-28-2012, 11:13 PM)
|
#103
I think the question "Hey, I want to learn how to program! What do I start with?" is typically the wrong question to ask.
It's more important to be interested in making something; anything, that would impossible to create without programming ability, and then to thoroughly investigate that part of the programming world either in tandem with CS coursework, or to be aware that the "theory" of CS is out there, and that there are resources that exist for that. I know you can go your entire programming career (professional or hobbyist) without being exposed to the "bits" as I like to call it (lower level programming, academic programming, theory) and be perfectly content with your knowledge so long as what you are trying to do is often "solved problem programming" -- that is, you aren't expected to do anything for which there are few resources available to help you with. Or none, for that matter. I think you can become an accomplished web programmer, or "retro game coder", or software engineer by picking a book that gets you started on that topic, and letting the author's choice of language be your entry -- assuming the book doesn't take the approach that you've programmed before. On the other hand, there are certain fields where not just anyone can reasonably be expected to go off and do things effectively without having a heavy list of per-requisites met, and this generally includes a lot of academic know-how (Data structures, algorithms, those kinds of things), a strong grasp on mathematics, and simply a lot of experience. These are the kinds of things where a very specific skill-set comes into play, and that's the kind of skill-set that one gets from a long period of study, exploration, and failing enough that they've learned how to succeed. The point of a CS degree, in my opinion, is to help programmers become aware of problem-solving techniques that have existed in theory since before you could write code to do it! These are things where you run into a problem and say "Ah! I've seen this before!" or "I've been here before" and you instinctively know the tool for the job, and the theory cements your rightness about the choice for the direction you take on solving that problem. Maybe you haven't seen the problem before, and you can take an amalgam of other things which form a "new" solution. All of this is a result of learning how to be a "thinking" programmer. a White-box programmer instead of a Black-box one. Heavy academics and training can help here. So the question of "learning to program" is faulty by nature of the beast. Some people want to learn enough to get done a particular task, others are much more dedicated to the field itself and want to know the ins-and-outs. I've been programming for 8 years, and I never feel like I know enough, and I'm always catching mistakes that academics tried (and continue to try) to drill out of my head, and in my spare time I'm generally experimenting with mathematics, and games programming, and just constantly learning. I learn something new nearly every day, and it gets me thinking about things I couldn't do in the past that I may be able to do later. The greatest singular piece of advice I could give to another learning programmer (and you should always be learning) is to, when you are ready, teach. Learning by teaching is one of the most powerful tools, I think, so if you have the option to TA, or something, do it. If you have a friend who wants to learn how to code, and you just started, "act as if" and help him learn. Get involved with other people who program, and share what you know, and learn from them. Try to forget about language rivalries, and other things that aren't at the core of the (loosely defined) science. And obviously write code a lot. Don't ever turn down writing something because you think you can do it; write it, so that you know you can. The small skills and insights you develop from writing the simplest of things can stick with you forever.
Last edited by Spoo; 05-28-2012 at 11:21 PM.
|
|
card-carrying scientician
(05-28-2012, 11:48 PM)
|
#104
Okay, incredibly stupid question time: I've been doing some complex programming for so long that I've completely forgotten the stupidly simple stuff, to the point where I can't figure out how to stop
Code:
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
cout << "test" << endl;
return 0;
}
EDIT: In C++ |
|
Member
(05-28-2012, 11:51 PM)
|
#105
Windows specific - system("pause"); |
|
Member
(05-28-2012, 11:53 PM)
|
#106
I recently started using Visual Studio, coming from Eclipse. VS is a lot more thorough, I'd say. Less intuitive, maybe, but it is a way bigger system. Debugging works like it always did in Eclipse, and intellisense is fantastic.
|
|
Member
(05-29-2012, 12:07 AM)
|
#107
|
|
Member
(05-29-2012, 12:11 AM)
|
#108
Hello, Programming-GAF!
Just graduated on Sunday with a BS in Computer Science! Now for the job hunt. I'm a little worried, I've never done large scale programming before. Just class projects and an internship. Any advice on the things I should emphasize in a interview for a software engineering position? |
|
Member
(05-29-2012, 12:14 AM)
|
#109
|
|
Member
(05-29-2012, 12:19 AM)
|
#110
I consider myself to have a fairly basic game development knowledge. But I still would love books on basic game development (I read a little from Game Engine Architecture and thought it was quite good, but it still focuses a lot on advanced AAA game engines), so if you know any, let me know!
Also Game AI by Example is great. |
|
Banned
(05-29-2012, 12:22 AM)
|
#111
Wow, the existence of this thread right now is too convenient.
Is anyone good with ActionScript 3? Basic stuff, I know, but I'm having a bit of an issue. So, I have this code in my class: Code:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
[SWF(width="550", height="400", backgroundColor = "#FFFFFF", frameRate ="60")]
public class Ball extends MovieClip
{
public var ball:MovieClip = new MovieClip();
public var vx:int = 0;
public var vy:int = 0;
public function Ball()
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stage.addChild(ball);
ball.x = 350;
ball.y = 250;
}
public function keyDownHandler(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.LEFT)
{
vx = -5;
}
else if (event.keyCode == Keyboard.RIGHT)
{
vx = 5;
}
else if (event.keyCode == Keyboard.UP)
{
vy = 5;
}
else if (event.keyCode == Keyboard.DOWN)
{
vy = -5;
}
}
public function keyUpHandler(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.RIGHT)
{
vx = 0;
}
else if (event.keyCode == Keyboard.UP || event.keyCode == Keyboard.DOWN)
{
vy = 0;
}
}
public function enterFrameHandler(event:Event):void
{
ball.x += vx;
ball.y += vy;
}
}
}
Code:
import Ball; var ball:Ball = new Ball(); stage.addChild(ball); Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Ball() at Untitled_fla::MainTimeline/frame1()
Last edited by Misguided; 05-29-2012 at 12:31 AM.
|
|
Member
(05-29-2012, 12:41 AM)
|
#114
Code:
public function Ball()
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stage.addChild(ball);
ball.x = 350;
ball.y = 250;
}
Last edited by Septimius; 05-29-2012 at 12:43 AM.
|
|
Banned
(05-29-2012, 12:45 AM)
|
#115
|
|
Member
(05-29-2012, 01:05 AM)
|
#117
Your Ball class extends MovieClip, but it also contains a MovieClip. Why is that? You're adding your class-level variable "ball:MovieClip" to the stage in the Ball constructor. Then you're also adding ball:Ball to the stage? Why both? It seems to me you should drop the ball:MovieClip variable in your Ball class entirely, and naturally don't add it to the stage. However, I don't know why you're getting a null object in Ball(). I'm pretty sure that the ball:MovieClip variable should get initialized before the constructor, so it seems weird to me. If you're really going to keep your class-level MovieClip variable, try initializing it in the constructor instead like this: Code:
public class Ball extends MovieClip
{
public var ball:MovieClip;
public var vx:int = 0;
public var vy:int = 0;
public function Ball()
{
this.ball = new MovieClip();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stage.addChild(ball);
ball.x = 350;
ball.y = 250;
}
...
In C#: Code:
var rgen = new Random(); //<--this seeds with the time. Do this at some point separate from actually needing the numbers.
//later on:
var numbers = new List<double>();
for (int i = 0; i < 100000; i++)
{
numbers.Add(rgen.NextDouble());
}
//now numbers contains a list of 100,000 random doubles.
Last edited by usea; 05-29-2012 at 01:09 AM.
|
|
Banned
(05-29-2012, 01:28 AM)
|
#118
So the Ball() class extends MovieClip; does that mean that it's not supposed to contain variables that are made into MovieClips? I'm confused... I tried not adding my ball to the stage from the class file, only from the timeline actions, but it still isn't working. But I'm still having troubles; this is of course very confusing for you as it is for me. Thanks again for all your help. BTW: Alone that code in the class executes and works perfectly; it's just calling it into the stage that I'm really having trouble with, for some reason.
Last edited by Misguided; 05-29-2012 at 01:48 AM.
|
|
One day I realized that sadness is just another word for not enough coffee.
(05-29-2012, 01:52 AM)
|
#119
When you say "Ball extends MovieClip", it means your ball is a MovieClip and possesses all its properties and methods. You don't need to include another MoveClip object inside the ball unless you want parented MovieClips.
So if somewhere else in the code you have something like: Code:
Ball testBall = new Ball(); So cutting out the redundancies in your code, it would look like: Code:
public class Ball extends MovieClip
{
public var vx:int = 0;
public var vy:int = 0;
public function Ball()
{
x = 350;
y = 250;
}
...
|
|
Member
(05-29-2012, 01:56 AM)
|
#120
Let's start from scratch. The error is that you have some null variable which has one of its methods or properties referenced. You need to track down exactly what line is calling a method/property on a null variable, and then find out why that variable is null when you expect it not to be. Google tells me that you can do this to find out the line number in flash professional:
Quote:
Then, you'll have a stack trace after the error like this, which says where the error is coming from:
Quote:
Also if you just google the error and look at some of the results, they have common problems and solutions that cause this error to crop up. |
|
Banned
(05-29-2012, 01:56 AM)
|
#121
Code:
import BallKeyboard(the name of my class); |
|
One day I realized that sadness is just another word for not enough coffee.
(05-29-2012, 02:01 AM)
|
#123
Have you linked your ball class to your .fla document? I think that's the missing step and now that I look over your original question I think that's what you were asking in the first place.
You can find the tutorial here: http://active.tutsplus.com/tutorials...lass-in-flash/ Basically, it designates one of your source files as the "Main" class and will initialize an instance of those upon playback. In that class, you will initialize all your other classes, and add them to the stage. The reason why stage.addChild(ball); doesn't work with your class is because the environment isn't even calling it, only the "Main" class has direct access to the stage supervariable. The Main class should, if I remember correctly, always extend a DisplayObject or a class that inherits from DisplayObject, since the program will be calling the draw method of that DisplayObject every frame. Usually it's a MovieClip but Sprites also work, although to get animation working with Sprite objects you need to jump through a lot of hoops. And yes you can have MovieClip objects in other MovieClip objects. My confusion was thinking that your Ball class was supposed to represent a ball, though I now realize it is intended to be your "Main" class.
Last edited by Haly; 05-29-2012 at 02:10 AM.
|
|
Member
(05-29-2012, 02:03 AM)
|
#124
PHP coder for about 10 years here, do want to learn a bit of python as well. Just want to throw my support behind Sublime as well. Most amazing text editor I've used. I can't code in it full time because of the lack of code completion over projects - it has a plugin but crashes indexing large projects - which keeps me going back to eclipse, but man, I love this thing so much. Git support, Gist support, PHPUnit plugins, there are just so many amazing plugins for this.
|
|
Member
(05-29-2012, 02:15 AM)
|
#126
I learned x86 and x51 assembly, and in retrospect they were both mostly a waste of time unless you end up working in a really niche area.
I think the problem is that nowadays (at least for x86), the semantic gap between assembly and the microcode the architecture is designed around is pretty large, so you really don't learn as much about the architecture or optimization principles as you might think. The thing that is probably still a good takeaway is drilling in the idea of the overhead of a function call. |
|
Banned
(05-29-2012, 02:15 AM)
|
#127
|
|
Member
(05-29-2012, 02:22 AM)
|
#128
I only vaguely know MIPS Assembly, personally. Don't know a damn thing about X86 assembly. |
|
Member
(05-29-2012, 02:25 AM)
|
#129
|
|
One day I realized that sadness is just another word for not enough coffee.
(05-29-2012, 02:27 AM)
|
#130
So for example, you could type Ball.as in that textbox in the Document properties, and if your folders are set up the right way, your .fla file will look for Ball.as upon compiling, and then initialize an object of type Ball on playback and then add that to the stage. Or if you have another class, say, BallTest, you can set that as the Document class. In the BallTest constructor you would have lines like. Code:
Ball ball1 = new Ball(); addChild(ball1); You don't need any additional functions in your Document class, although you can always add them as desired. The .fla will automatically call the constructor of its Document class (if any) and nothing else, other methods will have to be called manually within the class. At the minimum, this is all the code you'll need in order to get a ball onto your stage and moving forward every frame. Code:
package
{
import flash.display.*;
public class Main extends MovieClip
{
private var:Ball ball1;
public function Main()
{
ball1 = new Ball();
addChild(ball1);
addEventListener(Event.ENTER_FRAME, frameLoop);
}
public function frameLoop(event:Event):void
{
ball1.x += 1;
}
}
}
Last edited by Haly; 05-29-2012 at 02:48 AM.
|
|
Member
(05-29-2012, 02:39 AM)
|
#132
Motorola 68HC11 assembly was one of the simplest languages I learned. There's very little syntax and few leaky abstractions. I quite enjoyed it.
Last edited by Slavik81; 06-01-2012 at 08:00 PM.
|
|
Member
(05-29-2012, 02:56 AM)
|
#134
What language is used for web development for those slick web site animations.. For example, with twitter when a new tweet pops up, there's a little animation that drops down advising of a new tweet.. I can't think of many other examples.. I'm sure they're used with Facebook and other websites that use live updating.
|
|
One day I realized that sadness is just another word for not enough coffee.
(05-29-2012, 02:57 AM)
|
#135
Javascript usually. And I guess eventually HTML5 as the web moves forward. There are open source Jscript blocks to achieve a wide variety of animations and effects, all free to use and modify. You don't really need anymore than a basic understanding of Jscript to make good use of those resources.
Mind you while they certainly look nice, they reduce usability because they can be memory intensive.
Last edited by Haly; 05-29-2012 at 02:59 AM.
|
|
Member
(05-29-2012, 02:59 AM)
|
#136
Or an AJAX call, but not good practice for that |
|
(05-29-2012, 03:05 AM)
|
#137
Self-teaching programming has always seemed like a really bad idea to me. I'd be interested in hearing success stories, but from my -- probably biased -- perspective, it seems like developing bad habits would be so damn easy. Programming itself has always seemed like a means to an end to me, rather than the end itself.
|
|
Member
(05-29-2012, 03:06 AM)
|
#138
Edit: Oops forgot about Javascript existing.
Last edited by Luigiv; 05-29-2012 at 03:09 AM.
|
|
Banned
(05-29-2012, 03:08 AM)
|
#139
|
|
Member
(05-29-2012, 03:10 AM)
|
#140
|
|
Member
(05-29-2012, 03:10 AM)
|
#141
Setting it to = new Ball(); makes perfect sense. It's a Ball variable. Setting it to an instance of Ball is about the only thing you can do. |
|
Member
(05-29-2012, 03:12 AM)
|
#142
|
|
Banned
(05-29-2012, 03:13 AM)
|
#143
Ah, I see. I'm just so used to condensing all that down to "private var ball1:Ball = new Ball();" (unless that wouldn't work in this case?)
|
|
Member
(05-29-2012, 03:15 AM)
|
#144
Last edited by rpmurphy; 05-29-2012 at 03:25 AM.
|
|
One day I realized that sadness is just another word for not enough coffee.
(05-29-2012, 03:16 AM)
|
#145
Code:
private var ball1:Ball; Code:
ball1 = new Ball(); This assumes that Ball extends MoveClip. Later on you're going to have functions exclusive to Ball, which is why ball1 needs to be instantiated as a Ball object. Otherwise bad things may happen.
Quote:
Last edited by Haly; 05-29-2012 at 03:20 AM.
|
|
Member
(05-29-2012, 03:16 AM)
|
#146
It would work, but convention has variable initialization in the constructor. Most people would say it's easier to read, but that's subjective.
|
|
card-carrying scientician
(05-29-2012, 03:42 AM)
|
#147
God I hate Microsoft sometimes. I wrote a short program for a friend in VS2010, little more then a command line interface, one .cpp file. When she tries to run it it turns out she needs the .NET framework but even after downloading and installing it and restarting it it doesn't run, saying that it needs the same file, MSCVR100
|
|
Member
(05-29-2012, 04:32 AM)
|
#148
|