I Require Aid.

Posted by Charlie Carlo on Aug. 9, 2012, 10:39 p.m.

Okay, so as you may know, I created a super awesome lighting engine.

As you may not know, I have no idea how to handle tiles with code.

My current way to put a background and foreground into the room is create them both with tiles separately and save them as a huge image and put it in the game. As you can imagine, this is retarded.

The reason for this is, the view isn't actually a view. Instead of the view looking at different parts of an image, the image just draws itself at different parts depending on where the view is. Poly taught me that crazy technique, but I don't think he uses tiles.

I don't know if I can use tiles with this system, though, which sucks.

I want to just place tiles by hand in the room editor. But in order to do this I'll have to alter my drawing script to:

1. Hide all tiles (because otherwise they'll draw weirdly on top of the surface.)

2. Draw all tiles at depth 1 onto a surface, with an offset of -view_xview, -view_yview.

*My current script goes here

3. Draw all tiles at depth -1 onto the surface with the same offset.

Basically, I'm asking if anyone knows how to draw all tiles at a certain depth onto a surface like a background.

Plox, guys, I really need help here.

Comments

KaBob799 12 years, 3 months ago

For loops are just a different (more confusing to those who have never used them) way of writing while loops.

Charlie Carlo 12 years, 3 months ago

Quote:
Based on what I've assumed it would seem that you could just rework the lighting to be drawn relative to the view location instead of drawing it straight on and having everything else move relative to the view location. I mean, I know there's a background element to the lighting but why does that have to be attached to the tile background?
The lighting script relies on drawing to multiple surfaces (and blending surfaces atop surfaces) in the draw event. Drawing to surfaces in the draw event makes views stubborn and unwilling to be helpful, so I was forced to change the entire script to draw everything the way a view would, by offsetting drawings by the coords of the view.

Quote:
For loops are just a different (more confusing to those who have never used them) way of writing while loops.
:F

What's a while loop.

EDIT: Do not worry, I will bother Tubey until he reveals to me the secrets of the loops. Thanks for the help.

Castypher 12 years, 3 months ago

I use for loops when the travel and destination is absolute. I use while loops when they're approximate. It's not an easy thing to explain, but seeing these things in action really helps.

I'll just say that 90% of my bullet hell patterns are controlled by for loops, and that aside from a few specific things, I don't really use while loops.

I like to say that while loops are most useful when either the destination or the means of getting there is uncertain. Take 39DLL for example. That thing's caught in a neverending while loop in order to receive messages, and it breaks out whenever a message is received.

Zac1790 12 years, 3 months ago

When you draw surfaces you're drawing to the display, not the view - surfaces ignore views. Also, the manual says to never change surface targets during the draw event. I've noticed serious differences in results on different graphics cards when this rule is violated.

Charlie Carlo 12 years, 3 months ago

Quote:
I've noticed serious differences in results on different graphics cards when this rule is violated.
Then I can imagine certain people will be unable to play my game.

Quote:
You should never change the drawing target while you are actually drawing on the screen, that is, never use it in drawing events. This will cause serious problems with the projection and viewport.
D:

I should prepare for unforeseen consequences.

Right after I figure out this tile debacle.

ludamad 12 years, 3 months ago

Quote:
I've never used for loops so I can't honestly say I understand
wat

Charlie Carlo 12 years, 3 months ago

Look, man, previous to this game project I'm working on now, I've used nothing but D&D.

Even this game is kinda half D&D with actual code plopped in random places like micro-chips.

ludamad 12 years, 3 months ago

I guess I'm just in awe that GM is that usable without coding stuff in loops. I write 10 for loops a minute in my C++ project.

Castypher 12 years, 3 months ago

Just take it as a lesson that when you move on to bigger and better languages, you develop an elitist attitude and look down on those people who are using the tools you're now too good for.

Some people don't want to program for a living, you know, and it's perfectly fine if they want to settle with a lower-tier tool.

JuurianChi 12 years, 3 months ago

Quote:
Some people don't want to program for a living, you know.

Get out of my head, Kilin.