Game Development Community

Need help with Tutorial scripting - Ninja Platformer

by Gabriel Leow · in Game Design and Creative Issues · 08/13/2012 (12:37 pm) · 1 replies

Hi guys, I am a new torque2D user (no programming or any IT background) and have been reading the provided documentations really dilligently. I tried to follow the Ninja tutorial but couldn't even get my ninja to move at all.

I have checked through the codes in my player.cs files many times and it's exactly as instructed in the tutorial.

Can any kind souls send me a copy of the completed and working player.cs file so that I can compare and see where I did wrong?


Additional info:

*I am very sure I have followed tutorial instructions for collision settings for "playerStand" as well as my tile layer grids. I have also named the ninja animated sprite with pGuy and playerClass as instructed.

*Alternatively, I may have included the " exec("./player.cs"); " code in the wrong place and therefore player.cs did not even load at all? Can someone also direct me on the correct file to input this code as well as the proper position to place it?

*the location of my plyer.cs file and game.cs files are in document/MyGames/miniplatformer/game/gameScripts

is that correct?

About the author

I love games and have started a company to spread that love. Now I think it's time for my to start making games too! www.playnation.com.sg

Recent Threads


#1
08/13/2012 (10:13 pm)
Update:

I read the threads of other people and realised there is a file that will tell you if there is an error in your scripts. this is what my console file recorded

Quote


>>> Advanced script error report. Line 23.
>>> Some error context, with ## on sides of error halt:
^moveMap.bindCmd(keyboard, "left","playerLeft();", "playerLeftStop();");

^moveMap.bindCmd(keyboard, "right","playerRight();", "playerRightStop();");

^moveMap.bindCmd(keyboard, "space","playerJump();", "");

}



// Following codes are key handler





function playerLeft()

{

^$pGuy.moveLeft = true

}

##f##unction playerLeftStop()

{

^$pGuy.moveLeft = false

}

function playerRight()

{

^$pGuy.moveRight = true

}

function playerRightStop()

{

^$pGuy.moveRight = false

}

function playerJump()

{



}



//following codes are movement handlers



function playerClass::updateMovement(%this)
>>> Error report complete.

Activating DirectInput...
DirectInput joystick failed to enable!
Loading compiled script C:/Users/User/Documents/Torque projects/miniplatformer/game/data/levels/level1.t2d.
DirectInput deactivated.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...

Unquote

What is the error in my "line 23"??