Windows Missing Main ()

I was following a video tutorial and I created a shader with the following code:

//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor = vec4(1.0,1.0,1.0,gl_FragColor.a)

}

I get the "missing main" compile error. Also in the video the main word is in red, and in my version it stays grey.
 

muki

Member
Shader syntax requirements are far more strict than when programming in GML (and unfortunately the compiler doesn't do as good a job telling you what's wrong). Add a semicolon ; to to the end of your second line.
 
That worked thank you. I have another question regarding camera target.

Here is the relevant code of obj_camera End Step event:

camera_set_view_pos(camera,camX+30,camY);
camera_set_view_size(camera,camW,camH);


As you can see I am adding +30 to the X. I did this so it puts the player on the left side of the screen, with the camera still tracking his movement. This works perfect when the player is walking to the right. If i use -30 it works perfect if player is moving left. As you can guess I would like to figure out a way to have it be a -30 when the player is moving left, but +30 when going right. Any ideas how I can do that?

I have tried using If and else statements but it doesnt seem to update when I move left or right.
 

Roderick

Member
If the player is moving right, they've got a positive horizontal speed. If they're moving left, it's negative. Instead of adding or subtracting 30, add (30 * sign(horizontalSpeed)

 
Top