Eat. Sleep. Code: The Computer Programming Thread, Ver. 010

What are you using this collision for? Are you using it for like actual physics so you need to bump the player out if he overlaps/stop him from overlapping stuff? or are you just doing a “move screen” call whenever he hits far enough, so like is each array element an entire room ALA metroid, or would a room a 10 by 10 space in the 2d aray, and say there was a platform in the middle of the room point 5,5 would be makred as platform? IT seems like you are treating each part of the array as a chunk of the level, have you defined how big of a chunk it is? What’s your reasoning behind using this array stuff for the the positions of objects in the level?

Before, I had a collision box for each tile that was drawn on the map, but I want to move away from that because there are more efficient ways of handling collision in large levels. The purpose of this array is to check collision against floor tiles since there are a lot of them. I also use the same array to draw the level on the screen. The objects contained in the array are strings representing empty space, strings for floor tiles, a string for the player position, and the exit point.

I’m sure I can get this to work. I’ve used this kind of collision checking before for other games I made, but this one’s a bit bigger in scope and has more physics.

If I am understanding correctly, you have a 2d array which represents the game screen

string currentLevel[width][height];

then you’re trying to be able to have the player move, without always just jumping from array index to array index. So he could move some pixels, but still be considered inside one of the tiles.

If you’re tracking player position, maybe keep it as separate x/y values

int playerX, int playerY;

You said the tiles are 48x48 pixels. So then if you take the playerX, and divide it by 48, and floor it, you should have your X index. Same with Y index. then you could test for collision against that one tile. You might need to tweak it a bit, but I think that’d be the easiest way to tell which tile in the “array” you are currently in. You could move 10 pixels and still not jump to a new tile with this method.

Also, I have to ask, why are you using Strings for the array? Strings are much slower than just defining everything as an int and using constants;

const int emptyTile = 0;
const int floor = 1;
const int wall = 2;

etc

With how often you’ll probably be accessing the array, the integer definitions will speed it up, and I’m not sure what the strings would be necessary for

The string implmentation was just for when I want to view the file containing the data to make sure the layout is correct. It’s easier to read than just using numbers. For example, “P” is the player, while “S” is a spike. I could probably use char instead.

It just depends on how much optimizing you need to do, if its still in prototype phase then it’s not really worth worrying about

you could also just make it chars which is just as fast as an int, theoretically, since its a fixed length datatype

Yeah, the game is a prototype. I’m working with a team, and our goal is to have something to present by the end of this month.

Your suggestion helped, by the way. It’s not 100% working, but it’s doing the array update like I wanted. I had to offset the level so the player didn’t have a negative position. Now I just have to mess with numbers. Thanks!

Glad to hear!

An update to the issue I was having: everything’s good now. :slight_smile: Since I offset the level’s tile positions, I had to offset the player’s array location so that everything would work properly.

I just turned down a phone interview for a Help Desk Agent Position. I only applied there because I got desperate one week not having any jobs to apply to and I could just send my resume in to them. This was well over 3 weeks ago. Well, they emailed me trying to set something up. I turned it down nice, making it seem like the daily commute (1hr+) was the main reason I didn’t want it.
My question is: can this come back to bite me in ANY way? I know I don’t have to report this to unemployment, since it wasn’t a job offer. Still, could there be any blowback whatsoever?

I wouldn’t think so

Yeah I turned down a testing job at microsoft because I had a few other interviews kicking around. Doubt anyone would ever even know or care.

over 2 months ago a family member told me he’d create my website within a week for free but to this day he’s done absolutely nothing, so I have to do it myself.

I was told that to use MySQL I have to buy my domain name first. Is it possible to test the site before putting it online?

I’m using PHP and MYSQL.

Yes, you should be able to do everything locally. Run a DB on your computer, connect to it, test the website, etc. You can do all that before you need to buy a domain, or web space, or a web server.

Just by a wordpress theme, or download a free one, then customize it. Save yourself a lot of time and hassle.

Sorry to bring this thread up for more job advice, but I was wondering: how did you guys look for jobs close to you?
The job I interviewed for recently was 40+ minutes away from where I live. So, it’ll be an hour commute to and from work every day (more if I catch shopping traffic on the way home). I just had a phone interview for a company I applied to that’s 50+ minutes away.

I don’t care about a long commute if the pay is right. Still, the reason I’m willing to do that is because there’s no computer jobs near me, it seems. My last job was pretty much the only one nearby I was qualified for (still a 10+ min ride). However, my job hunt is mostly just job sites. I know they’re kind of inadequate when it comes to job hunting. Still, I never knew how to network and look for jobs that aren’t advertised when my qualifications aren’t that good.

I went through the job posting board of the university I had just graduated from, and found some local companies. I also live in a decent spot (Long Beach), about an hour south of LA, and like 45 minutes north of orange county, so I have pretty much all that spectrum of possible jobs in the LA area. Of course commuting 1+ hour isn’t really something I want to do in this phase of my life, I’ve done it enough in the past.

Is moving closer to the job not possible as well? Not sure what your situation is like, as far as being able to move. You should try to move closer to where the hubs are, generally tech companies like to cluster I’ve noticed.

I just lucked out and managed to get one close to home, 90% of people probably dont have such companies in their backyard.

I didn’t, I looked for jobs anywhere I could get 'em.

Well, I can’t just move closer at the moment. Don’t have the money (especially since I’m trying to not dip into my emergency fund post-layoff). Maybe that’ll change.

But something just came up. What do you guys know about noncompete agreements? Should I be running? The company I interviewed for let me know that I’d have to sign one that lasts 3 years after I leave the company if I were to sign on. I haven’t seen the actual agreement yet (I just discussed it with the HR lady), but it seems fishy to me. On the surface, things look straightforward: I can’t poach clients, start my own company similar to theirs, work for a competitor, or take any specific programs I develop for them with me. But I don’t know how far things will reach. Specifically, what of my code will they see as their property? Have any of you had to deal with this?

bumping.

Won’t be getting a CS degree since I’m already locked into my current one and took some time off. Looking at this was really helpful, as I want to get back on the growing path. Math and Science has always been my weak spot, so I’m trying to up those as well. My ‘back yard is full of tech’ so I figure learn something new, keep working hard and something might pay off.

You should apply to places out of state/town if you’re willing to relocate. Some companies will help you do it.