a few woes
by rennie moffat · in iTorque 2D · 06/17/2010 (9:30 am) · 181 replies
Hi there, anyone who has been following me this week understands my situation. I built, stupidly, my app in TGB, not iTGB, anyhow, essentially I have simply been transferring all I did into iTGB however I have run into two problems.
1. when I run my game it crashes.
2. my player animation (idling) is of the same size (object is 32x32) however in TGB the actual sprite, at least what was visible was only a quarter of that size. It sat, very quietly in the middle, in other words it did not take up the whole 32x32 space. In iTGB however the object is still 32x32 but the animation is bloated. It is stretched out to fill the entire space. I am not sure why, any suggestions?
edit; cont from pt2.
I have just noticed, as I say, my level, opened up, everything appears to be fine. all objects, positions, sizes are correct. However, when I drag in those same elements into the editor fresh, they are a good 20% larger. I think this may have something to do with resolution, but in the level.t2d's I see no "resolution" or something like that to adjust.
3. Images are not being called.
I have redone every image i needed, created animations, etc. Saved then reloaded my game. All images are gone. They still exist in the folder "game/data/images" but are not called into the editor.
3 cont.
I just created a whole new project and loaded in one image, thinking one of my files may have corrupted the project, but the same thing happened. The message i get is...
How can this be? I created the image, simply calling into the editor, pulled it onto the level editor, saved, then reloaded the game just to test.
If anyone can help me out with these pressing issues I would greatly appreciate it.
Thanks.
1. when I run my game it crashes.
2. my player animation (idling) is of the same size (object is 32x32) however in TGB the actual sprite, at least what was visible was only a quarter of that size. It sat, very quietly in the middle, in other words it did not take up the whole 32x32 space. In iTGB however the object is still 32x32 but the animation is bloated. It is stretched out to fill the entire space. I am not sure why, any suggestions?
edit; cont from pt2.
I have just noticed, as I say, my level, opened up, everything appears to be fine. all objects, positions, sizes are correct. However, when I drag in those same elements into the editor fresh, they are a good 20% larger. I think this may have something to do with resolution, but in the level.t2d's I see no "resolution" or something like that to adjust.
3. Images are not being called.
I have redone every image i needed, created animations, etc. Saved then reloaded my game. All images are gone. They still exist in the folder "game/data/images" but are not called into the editor.
3 cont.
I just created a whole new project and loaded in one image, thinking one of my files may have corrupted the project, but the same thing happened. The message i get is...
Quote:
Invalid Project Data
This project contains 1 invalid datablock. This is likely because a referenced image file was deleted from the project directory.
How can this be? I created the image, simply calling into the editor, pulled it onto the level editor, saved, then reloaded the game just to test.
If anyone can help me out with these pressing issues I would greatly appreciate it.
Thanks.
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#82
I am not trying to make them look differnt, I built my app in TGB hoping it would transfer very easily, which I am sure it would if I knew all the ins and outs. I am sorry if I am being a bit much but I just want this up.
I finally got a project running on the iPhone Simulator, except my main behavior does not work, while it does work in iTGB.
The code is essentially this.
owner.setUseMouseEvents(true);
onMouseUp()
%this.player.moveTo(%this.ownerPosition);
Thats it, it works like a charm, but for some reason does not or is not working on the iPhone Simulator. I am not sure why
@Marc
you had mentioned setting physicsSuppress to false, I am not sure why, but I did and that did not work. I know behaviors are working as I tested one with a particular behavior which clearly worked, so everything is loading, and running, but for some reason when I use my mouse, on the Simulator, it does not work.
I am going to try some more mouse based behaviors, ie, buttons to load levels.
We will see how it goes.
06/22/2010 (6:24 am)
@Mark, I am not trying to make them look differnt, I built my app in TGB hoping it would transfer very easily, which I am sure it would if I knew all the ins and outs. I am sorry if I am being a bit much but I just want this up.
I finally got a project running on the iPhone Simulator, except my main behavior does not work, while it does work in iTGB.
The code is essentially this.
owner.setUseMouseEvents(true);
onMouseUp()
%this.player.moveTo(%this.ownerPosition);
Thats it, it works like a charm, but for some reason does not or is not working on the iPhone Simulator. I am not sure why
@Marc
you had mentioned setting physicsSuppress to false, I am not sure why, but I did and that did not work. I know behaviors are working as I tested one with a particular behavior which clearly worked, so everything is loading, and running, but for some reason when I use my mouse, on the Simulator, it does not work.
I am going to try some more mouse based behaviors, ie, buttons to load levels.
We will see how it goes.
#83
06/22/2010 (6:57 am)
Rennie, can you post the actual code please around the onMouseUp so we can see the context?
#84
that's it. I set the owner to use mouse events, I set the player and velocity in behavior fields. PositionX and Y are set in onBehaviorAdd as the owners position. As I say it works in iTGB and TGB.
:::?
06/22/2010 (7:47 am)
function chunkBehavior::onMouseUp(%this, %mod, %worldPos, %mouseClicks)
{
%this.player.moveTo(%this.positionX, %this.positionY, %this.velocity, true);
}that's it. I set the owner to use mouse events, I set the player and velocity in behavior fields. PositionX and Y are set in onBehaviorAdd as the owners position. As I say it works in iTGB and TGB.
:::?
#85
06/22/2010 (8:06 am)
Okay, can you add an echo statement into the onMouseUp method and let me know if you see it printed in the xCode console (xCode menu Run->Console). That will tell us if you are receiving mouse events or not; if you are then it is likely to be a physics problem.
#86
06/22/2010 (8:08 am)
ok will do.
#87
06/22/2010 (8:14 am)
edit, answered.
#88
In my game/scripts/game.cs file, I was getting the error in the console. that it could not find object "player" as on line 160 of the game.cs. Game .cs ?! I had not seen all of this before but the function gamePlay() with in the game.cs, it involves alot of player position stuff, flips, if onGround.. what?!
Does this have anything to do? it also includes on mouseDown Events for left and right arrow,
tho I can see this having no impact on my game, does it?
06/22/2010 (8:27 am)
Ok I may have found something.In my game/scripts/game.cs file, I was getting the error in the console. that it could not find object "player" as on line 160 of the game.cs. Game .cs ?! I had not seen all of this before but the function gamePlay() with in the game.cs, it involves alot of player position stuff, flips, if onGround.. what?!
Does this have anything to do? it also includes on mouseDown Events for left and right arrow,
function leftArrow::onMouseDown(%this, %modifier, %pos, %clickCount)
{
$leftDown = true;
%this.setBlendAlpha(1);
}
function leftArrow::onMouseLeave(%this, %modifier, %pos, %clickCount)
{
$leftDown = false;
%this.setBlendAlpha(0.3);
}
function rightArrow::onMouseLeave(%this, %modifier, %pos, %clickCount)
{
$rightDown = false;
%this.setBlendAlpha(0.3);
}
function rightArrow::onMouseDown(%this, %modifier, %pos, %clickCount)
{
$rightDown = true;
%this.setBlendAlpha(1);
}
function rightArrow::onMouseUp(%this, %modifier, %pos, %clickCount)
{
$rightDown = false;
%this.setBlendAlpha(0.3);
}
function leftArrow::onMouseUp(%this, %modifier, %pos, %clickCount)
{
$leftDown = false;
%this.setBlendAlpha(0.3);
}tho I can see this having no impact on my game, does it?
#89
06/22/2010 (8:30 am)
it (game.cs) also uses these..function oniPhoneTouchDown( %touchCount, %touchX, %touchY )
{
}
function oniPhoneTouchUp( %touchCount, %touchX, %touchY )
{
}
function oniPhoneTouchMove( %touchCount, %touchX, %touchY )
{
}
//Luma: Tap support
function oniPhoneTouchTap ( %touchCount, %touchX, %touchY )
{
} do they have anything to do with touch, and my ability to not use touch/slash mouse events? I do not understand why they are here.
#90
my echo is returning. So my mouse down is being read. my object tho is simply refusing to move.
06/22/2010 (8:36 am)
I deleted the update gamePlay() from the game.cs, seemingly no effect ( i can not really see why it was in there ) please if some one can enlighten me as to why this may be essential tho.my echo is returning. So my mouse down is being read. my object tho is simply refusing to move.
#91
06/22/2010 (8:38 am)
Can we see game.cs please with the line 160 error. The other stuff is just default stuff that you are probably not needing at the moment. If you don't use that left arrow / right arrow stuff then just delete it.
#92
oniPhoneTouchDown: Unknown command.
oniPhoneTouchUp: Unknown command.
oniPhoneTouchTap: Unknown command.
chunkBehavior we in this mofo
so my onMouseDown is still being called but for every mouse down/up/tap I get an unknown, but still get my mouse event. I will leave the oniIphone commands in for now as they seem relevant.
The line is question was 160, and 186 from the game.cs. The lines were premaid/native to the script from iTGB. They both call for "player" which does not exist, thus the "unknown command" return from the console.
06/22/2010 (8:45 am)
yes thats what I did. I also, deleted (just to try the oniPhoneTouch commands). With out oni iphone commands in I get back, when I mouse clickoniPhoneTouchDown: Unknown command.
oniPhoneTouchUp: Unknown command.
oniPhoneTouchTap: Unknown command.
chunkBehavior we in this mofo
so my onMouseDown is still being called but for every mouse down/up/tap I get an unknown, but still get my mouse event. I will leave the oniIphone commands in for now as they seem relevant.
The line is question was 160, and 186 from the game.cs. The lines were premaid/native to the script from iTGB. They both call for "player" which does not exist, thus the "unknown command" return from the console.
///line 160 %pos = player.getPosition(); ///line 186 player.setPosition(%x, %y );
#93
In which case ... add these echo lines please and let me see the values.
06/22/2010 (9:15 am)
Okay, so we know that the mouse event is triggering and that onMousUp is being called.In which case ... add these echo lines please and let me see the values.
function chunkBehavior::onMouseUp(%this, %mod, %worldPos, %mouseClicks)
{
echo("player" SPC %this.player);
echo("player X" SPC %this.player.positionX);
echo("player Y" SPC %this.player.positionY);
echo("this.positionX" SPC %this.positionX);
echo("this.positionY" SPC %this.positionY);
echo("this.velocity" SPC %this.velocity);
%this.player.moveTo(%this.positionX, %this.positionY, %this.velocity, true);
}
#94
player X -39.000000
player Y 27.000000
this.positionX 24.010000
this.positionY 12.005000
this.velocity 60
all correct.
06/22/2010 (9:25 am)
player playerplayer X -39.000000
player Y 27.000000
this.positionX 24.010000
this.positionY 12.005000
this.velocity 60
all correct.
#95
06/22/2010 (9:41 am)
Rennie, can you add this echo as well please?echo("this.player.getPhysicsSuppress()" SPC %this.player.getPhysicsSuppress());
#96
@ true I got 1.
I removed it and no difference. It still did not move.
06/22/2010 (9:48 am)
I set it to false, and got 0. @ true I got 1.
I removed it and no difference. It still did not move.
#97
06/22/2010 (9:52 am)
Okay, well for anything to move it must be set to false. Can I see the datablock for the player ? Also, what does ChunkBehavior do?
#98
06/22/2010 (10:05 am)
well chunkBehavior is placed on an object. When that object is clicked (mouseUp) the player is called to move to that "chunk", many chunks are spread throughout the level.//the game/manages/datablock.cs
new t2dImageMapDatablock(playerImageMap) {
imageName = "~/data/images/player.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
compressPVR = "0";
optimised = "0";
force16bit = "0";
};///game/data/levels/datablocks/datablock.cs
new t2dImageMapDatablock(playerImageMap) {
imageName = "~/data/images/player.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
compressPVR = "0";
optimised = "0";
force16bit = "0";
};///game/data/levels/emptylevel.t2d
new t2dStaticSprite(player) {
imageMap = "playerImageMap";
frame = "0";
mUseSourceRect = "0";
sourceRect = "0 0 0 0";
canSaveDynamicFields = "1";
Position = "-4.568 -6.498";
size = "26.667 15.000";
Layer = "4";
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
CollisionPhysicsSend = "0";
CollisionPhysicsReceive = "0";
CollisionCallback = "1";
CollisionPolyList = "-0.285 0.147 0.108 -0.020 0.314 0.098 -0.074 0.255";
BlendIgnoreTextureAlpha = "0";
mountID = "22";
_behavior0 = "bigBoxClass";
///big box class sets the collisions physics etc for the object.
#99
06/22/2010 (11:14 am)
Can you add "UsesPhysics = "1";" to the player sprite please.
#100
Why set does this work?
What is it about iPhone and iTGB physics that differs that I must consider?
And Thanks!
06/22/2010 (11:27 am)
Holy S-word. It works!!!Why set does this work?
What is it about iPhone and iTGB physics that differs that I must consider?
And Thanks!
Torque Owner Scott Wilson-Billing
MeYuMe