[Solved] add hud scene
by Ghonium · in iTorque 2D · 10/11/2011 (10:35 am) · 12 replies
I have buttons on screen
when I press one of these button it make the player to move up
the problem
I mounted the camera to the player
and when I press upButton the player move but the button stay down until it disappear from screen
are there any way to make the buttons and player stay on screen?
any idea please ?
when I press one of these button it make the player to move up
the problem
I mounted the camera to the player
and when I press upButton the player move but the button stay down until it disappear from screen
are there any way to make the buttons and player stay on screen?
any idea please ?
About the author
#2
I used camera mount behavior which come in some tutorials
but I think if I want to mount the button and the player
I should make the button also move when the player move
which will be hard for my skill
I may use Gui if possible? but not sure about things in Gui since im beginner programmer
about the Gui:
1- is it possible to change Gui button to onTouchDown and onTouchUp ?
2- are Gui buttons can accept multiTouch ? because there will be 3 buttons 1up 1left 1right
10/11/2011 (11:35 pm)
Yes I use 1.5 I used camera mount behavior which come in some tutorials
but I think if I want to mount the button and the player
I should make the button also move when the player move
which will be hard for my skill
I may use Gui if possible? but not sure about things in Gui since im beginner programmer
about the Gui:
1- is it possible to change Gui button to onTouchDown and onTouchUp ?
2- are Gui buttons can accept multiTouch ? because there will be 3 buttons 1up 1left 1right
#3
I recently began using a second gui. This can be done quite easily. However, keep in mind, as far as iTGB touch and mouse events, ( certainly mouse, probably touch too) can not pass thru the top scenegrapgh to any below it, so... simply create globals (what I did).
So, build a second gui to sit on top of the game scene. The top gui, will hold your controls. So, onMouseDown, (touchDown>...? still not fully sure of the new touch commands and their full plethra of ability) set $player to move etc.
10/12/2011 (7:14 am)
Yes. I recently began using a second gui. This can be done quite easily. However, keep in mind, as far as iTGB touch and mouse events, ( certainly mouse, probably touch too) can not pass thru the top scenegrapgh to any below it, so... simply create globals (what I did).
So, build a second gui to sit on top of the game scene. The top gui, will hold your controls. So, onMouseDown, (touchDown>...? still not fully sure of the new touch commands and their full plethra of ability) set $player to move etc.
#4
but is it able to use GUI buttons in multiTouch ?
Button A up
Button B left
Button C right
can we press the three Gui same time to change direction or rotate while go up ?
10/12/2011 (8:40 am)
I think there are some way to edit the script to make the Gui able to onMouseDown and Upbut is it able to use GUI buttons in multiTouch ?
Button A up
Button B left
Button C right
can we press the three Gui same time to change direction or rotate while go up ?
#5
And yes, the beauty with onTouch is that it can send multiple events.. as in, if touch triggered on one object, touch can be triggered on another too. With mouse events only one mouse event could ever be passed.
10/12/2011 (9:06 am)
My point is that despite many attempts and time I have spent looking into it, I did not find a way to pass touch events thru a gui to another behind it. That being said I have not tried with the new touch events. Instead all my work was done with the mouseEvents. And yes, the beauty with onTouch is that it can send multiple events.. as in, if touch triggered on one object, touch can be triggered on another too. With mouse events only one mouse event could ever be passed.
#6
I have one cocos2d proj tutorial, have many buttons and they stay on screen corner all the time
one for handler as joystick and one button for sword and one for shield
there maybe a way to do buttons here and stay on screen when character move
ill wait sometime maybe someone know can explain it?
10/12/2011 (9:27 am)
but there must be way to do itI have one cocos2d proj tutorial, have many buttons and they stay on screen corner all the time
one for handler as joystick and one button for sword and one for shield
there maybe a way to do buttons here and stay on screen when character move
ill wait sometime maybe someone know can explain it?
#7
i am telling you how. either mount the btns to an object which has the camera mounted to it or create a second gui where the btns will always stay still in position.
10/12/2011 (9:43 am)
yes you can.i am telling you how. either mount the btns to an object which has the camera mounted to it or create a second gui where the btns will always stay still in position.
#8
http://www.garagegames.com/community/forums/viewthread/127281
10/12/2011 (10:01 am)
I think that this should help youhttp://www.garagegames.com/community/forums/viewthread/127281
#9
but I think yes this should solve the problem
if I couldnt understand it ill post here or there
thanks again :)
10/12/2011 (11:20 am)
thank you Andrea Ill read it until I digest the info but I think yes this should solve the problem
if I couldnt understand it ill post here or there
thanks again :)
#10
Idid the same what you did on this link
http://www.garagegames.com/community/forums/viewthread/125186
i made new project added 2 levels
i added 1 image in level1.t2d
and another different image on hud.t2d
also i changed the gui mainScreen as in ur link
also I added
but when i run i get only 1 image not both images
i use itorque 1.5
help me please im tired of this hud
10/13/2011 (1:10 pm)
rennie can you help me how to do the hudIdid the same what you did on this link
http://www.garagegames.com/community/forums/viewthread/125186
i made new project added 2 levels
i added 1 image in level1.t2d
and another different image on hud.t2d
also i changed the gui mainScreen as in ur link
also I added
// Load the .t2d file for this game
sceneWindow2D.loadLevel(%level);
hudWindow.loadLevel("data/levels/hudScene.t2d"); //added to load second sceneto the game.csbut when i run i get only 1 image not both images
i use itorque 1.5
help me please im tired of this hud
#11
then, I use this in a btn.
and thats it.
10/13/2011 (5:42 pm)
Ok. well did you create a second gui? If not just copy your mainScreen.gui and save it as hudScreen.gui. Also, adjust the names so sceneWindow2D, becomes hudWindow2D, mainScreenGUI becomes hudScreenGUI. then, I use this in a btn.
function loadLevelBtnBehavior::loadNewGame(%this)
{
echo("loadLevel::loadLevel");
sceneWindow2D.endLevel(); ///ends level in sceneWindow2D
sceneWindow2D.loadLevel("data/levels/levelTest.t2d"); //loads, in my case playable level
hudWindow2D.loadLevel("data/levels/hudScreen.t2d"); /// then load hud level via the hud gui
Canvas.pushDialog(hudWindow2D); //// to be sure push the hud window to the top of the scenegraph layers
}and thats it.
#12
thank you Andrea
now it worked
my mistake was because i didnt do second gui file
now I will need to add onTouchDown from Andrea post
http://www.garagegames.com/community/forums/viewthread/127281
10/14/2011 (1:37 am)
thank you Renniethank you Andrea
now it worked
my mistake was because i didnt do second gui file
now I will need to add onTouchDown from Andrea post
http://www.garagegames.com/community/forums/viewthread/127281
Torque Owner rennie moffat
Renman3000