# GreenMeteorTeam

Member Since 12 Jul 2005
Offline Last Active May 16 2013 01:34 PM

### In Topic: Developing Multi-Platform

10 May 2013 - 08:05 PM

Excuse me if I'm wrong, but I think for kSPEED you might want something closer to:

```kSPEED = room_speed / fps;
```

Rather than not understanding why it doesn't work in HTML5 I'm wondering why it works in Windows. The technique that I think you're going for is called delta time and is a great idea to use even on one platform due to differences in hardware.

### In Topic: Fullscreen Surfaces Lost

23 April 2013 - 01:17 PM

I'm expecting this to be a permanent change   Oracizan has a good point that you should always check to see if it still exists. If you're able to see a shift to full screen coming, you can save the current surface by creating a background from it (thereby putting it in regular RAM where it'll be as safe as the game state).

### In Topic: Minecraft Clone Smooth Lighting

19 April 2013 - 12:43 PM

The first time you come across normals in school, they're used to calculate friction. In that case they're for the force between the ground and the object trying to move across it. So the normal is a direction, not a coordinate, and it points perpendicular to the face of the vertex.

Now that you know that, you should be able to guess why it's used in lighting. It is used to decide if the face is pointing towards the light and how much it should be lit because of that and distance. Unfortunately, this also means that shadows probably won't be cast as you expected.

As an example normal, your upwards facing vertex would be

```d3d_model_vertex_normal_texture(model, x1, y1, z2, 0, 0, 1, xtex+xy,ytex+xy); // assuming your setup is for Z to increase upwards
```

And the right side of the cube would be

```d3d_model_vertex_normal_texture(model, x1, y1, z2, 1, 0, 0, xtex+xy,ytex+xy);
```

Normals are very easy to figure out for cubes. Just remember, it's the direction perpendicular to the face. It points away. If the face was a person's face, the normal would be the direction they're facing.

### In Topic: How Do I Use Directional Lights?

10 April 2013 - 07:07 PM

I can't seem to get directional lights working on windows at all. I've tried a simplified version of the above code:

```d3d_light_enable(0,1)
d3d_light_define_direction(0,0,lengthdir_x(1,mouse_x),lengthdir_y(1,mouse_x),c_white)
```

And even a random one on a key_press event:

```d3d_light_enable(0,1)
d3d_light_define_direction(0,random_range(-1,1),random_range(-1,1),random_range(-1,1),c_white)
```

Neither one shows any difference, and a point light is visible nearby in the meantime (using index 1).

Edit: Nevermind, it works if I define it in the draw event after the projection is set... which is weird as the point lights don't require that.

### In Topic: Multi-Touch in HTML5

08 February 2013 - 03:28 PM

Thanks TV