The following example shows how to update a position element and ensures that its position stays inside of the screen area. It is part of the helloworld4.ujml sample.
mPosX = mPosX + &MOVEMENT;;
if (mPosX &_GT;
(_getIntProperty(&_PROPERTY_INT_SCREEN_WIDTH;) - mWidth))
{
mPosX = _getIntProperty(&_PROPERTY_INT_SCREEN_WIDTH;) - mWidth;
}
The following example shows how to set values for elements of a three-dimensional array by looping through the indexes of all of its dimensions. It is part of the assignment.ujml sample.
// Fill a multidimensional array.
for (mCtr1 = 0; mCtr1 &_LT; 2; mCtr1++)
{
for (mCtr2 = 0; mCtr2 &_LT; 3; mCtr2++)
{
for (mCtr3 = 0; mCtr3 &_LT; 4; mCtr3++)
{
m3DArray[mCtr1][mCtr2][mCtr3] = _strcat(mCtr1, "/", mCtr2, "/", mCtr3);
}
}
}