Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualJETerán

Posted 31 August 2012 - 02:58 AM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory (right now an array) inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! Posted Image

EDIT 1:
Ok I tried to put 1 object to the inventory array but couldn't. this is all inside StoreCreation.as:

Main._instanceMain.addChild(TeddyBear._image); //successfuly appears in screen

TeddyBear._image.addEventListener(MouseEvent.CLICK, TeddyClick);

function TeddyClick(event:MouseEvent)
   {
	statistics.mainInventory.push(TeddyBear); //Ok i have mainInventory as global inside Statistics.as.  
  
	trace(statistics.mainInventory); // Each time I click that object in the store, I can see that each time, an object is added [TeddyBear] [TeddyBear]
	Main._instanceMain.addChild(statistics.mainInventory[0]._image); //This works great, but...
	(statistics.mainInventory[0]._image.x = 100; //When I try to put it in his location, it moves the image in the store, as if they were the same !!
   }
I'm missing something? This makes complete sense but don't know why is not adding to mainInventory and can't access that instance. It acts like if it were an instance of the instance :S

EDIT 2:
WOW it's been a long night.

Ok so far:
- I was able to move the hero between the rooms :D
- I have a GUI.as now, that stores things like game time, a nice menu when you press ESC. and a group of empty images of game objects. :D
- I create a tempo object inside GUI.as that works as an inventoryObject (taken from GameObjects.as) and I put it in the first empty image of game objects. :D
- I can detect when the hero is in front of the room2's in-game object (table) (for now, will work on the rest with same formula) and the inventoryObject is left over: hero AND table. :D

Now what's left:
URGENT: - Finish the inventory / store system so I can implement the inventory array in the GUI (Please help of EDIT 1 above)
- Make the others hitTests for the rest of the in-game objects. Easy.
- Make the hero look left when user hits left key. Tricky, I was some time doing this and couldn't figure out, tomorrow I will give it another try (later, actually)
- Make the hero's animation (I have the animation in the MC, I just need to play() it the hero moves)
URGENT: -Finish the game design, if player ends game, how to call again to call the MissionSelection function (I will work on what you told me Deft about it) :D

And that's pretty much what's next.

If I get this done fast, I could work on the rest 7 missions. Crap I will have only like 10 more hours before deadline.

If I get it done or note, I am in debt with you guys. Thanks so much for all your support in this desperate moments !!

After this, I will more close to this community, I want to help too. I learn A LOT.

See you in some hours, gonna take a quick nap :)





Thanks so much !!

#5JETerán

Posted 30 August 2012 - 05:53 PM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory (right now an array) inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! Posted Image

EDIT
Ok I tried to put 1 object to the inventory array but couldn't. this is all inside StoreCreation.as:

Main._instanceMain.addChild(TeddyBear._image); //successfuly appears in screen

TeddyBear._image.addEventListener(MouseEvent.CLICK, TeddyClick);

function TeddyClick(event:MouseEvent)
   {
	statistics.mainInventory.push(TeddyBear); //Ok i have mainInventory as global inside Statistics.as.  
  
	trace(statistics.mainInventory); // Each time I click that object in the store, I can see that each time, an object is added [TeddyBear] [TeddyBear]
	Main._instanceMain.addChild(statistics.mainInventory[0]._image); //This works great, but...
	(statistics.mainInventory[0]._image.x = 100; //When I try to put it in his location, it moves the image in the store, as if they were the same !!
   }
I'm missing something? This makes complete sense but don't know why is not adding to mainInventory and can't access that instance.

Thanks so much !!

#4JETerán

Posted 30 August 2012 - 05:53 PM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory (right now an array) inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! Posted Image

EDIT
Ok I tried to put 1 object to the inventory array but couldn't. this is all inside StoreCreation.as:

Main._instanceMain.addChild(TeddyBear._image); //successfuly appears in screen [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

TeddyBear._image.addEventListener(MouseEvent.CLICK, TeddyClick);

function TeddyClick(event:MouseEvent)
   {
	statistics.mainInventory.push(TeddyBear); //Ok i have mainInventory as global inside Statistics.as.  
  
	trace(statistics.mainInventory); // Each time I click that object in the store, I can see that each time, an object is added [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] [TeddyBear] [TeddyBear]
	Main._instanceMain.addChild(statistics.mainInventory[0]._image); //This works great, but...
	(statistics.mainInventory[0]._image.x = 100; //When I try to put it in his location, it moves the image in the store, as if they were the same !!
   }
I'm missing something? This makes complete sense but don't know why is not adding to mainInventory and can't access that instance.

Thanks so much !!

#3JETerán

Posted 30 August 2012 - 05:52 PM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory (right now an array) inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! Posted Image

EDIT
Ok I tried to put 1 object to the inventory array but couldn't. this is all inside StoreCreation.as:

[code=auto:0]
Main._instanceMain.addChild(TeddyBear._image); //successfuly appears in screen Posted Image

TeddyBear._image.addEventListener(MouseEvent.CLICK, TeddyClick);

function TeddyClick(event:MouseEvent)
{
statistics.mainInventory.push(TeddyBear); //Ok i have mainInventory as global inside Statistics.as.

trace(statistics.mainInventory); // Each time I click that object in the store, I can see that each time, an object is added Posted Image [TeddyBear] [TeddyBear]
Main._instanceMain.addChild(statistics.mainInventory[0]._image); //This works great, but...
(statistics.mainInventory[0]._image.x = 100; //When I try to put it in his location, it moves the image in the store, as if they were the same !!
}

I'm missing something? This makes complete sense but don't know why is not adding to mainInventory and can't access that instance.

Thanks so much !!

#2JETerán

Posted 30 August 2012 - 05:52 PM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory (right now an array) inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! Posted Image

EDIT
Ok I tried to put 1 object to the inventory array but couldn't. this is all inside StoreCreation.as:

[code=auto:0]
Main._instanceMain.addChild(TeddyBear._image); //successfuly appears in screen :)

TeddyBear._image.addEventListener(MouseEvent.CLICK, TeddyClick);

function TeddyClick(event:MouseEvent)
{
statistics.mainInventory.push(TeddyBear); //Ok i have mainInventory as global inside Statistics.as.

trace(statistics.mainInventory); // Each time I click that object in the store, I can see that each time, an object is added :D [TeddyBear] [TeddyBear]
Main._instanceMain.addChild(statistics.mainInventory[0]._image); //This works great, but...
(statistics.mainInventory[0]._image.x = 100; //When I try to put it in his location, it moves the image in the store, as if they were the same !!
}

I'm missing something? This makes complete sense but don't know why is not adding to mainInventory and can't access that instance.

Thanks so much !!

#1JETerán

Posted 30 August 2012 - 05:32 PM

Hey Deft, thanks so much for your reply.

Yes indeed, GameObjects extends from Sprite and now StoreCreation extends from GameObjects.

So far so good.

I already created the StoreCreation and I can now eventListenerClick for the first object !! so far ;)

I think, as you say, I'm in the right track.

Ok now, I'm working on inserting the objects in the inventory.

To do this, I have mainInventory inside all the global vars of the game. Because the inventory will be global (and will keep the objects bought during all the game), I am working on adding the objects clicked in the StoreCreation to it.

Back in the StartGame.as, I'm looking the way to show those objects already inside mainInventory.

I'm on this right now, but ANY suggestion will be awesome !! :)

PARTNERS