on 04-09-2012 07:41 PM
Before being introduced to GameEngine2d, I would say that I never really used someone elses engine. I usually had my game loop, which held a clear(), update() and draw() functions. By doing this I knew exactly how to update my objects and so forth. So for my current issue. I am attempting to create a tile based game or background if you will. I have created a class called Map that subclasses SpriteList. I call a method on the Map object to read in a texture, setup the tiles with the correct size and position, Every tile is a sprite and stored in the SpriteList. I then add this to the scene. Once I do that I get the background as I want it, which is great however I am now attempting to move the map so to speak and cannot figure out the best way to do so. I have created a moveX function on the Map object and in return updates the Map.x value (checked with Console.WriteLine()). So in my while loop i check gamepad to see if the left or right button has been pressed and if so I am updating Map.moveX( some int ). My problem is the sprites in the list are obvisouly not being updated with the new x coordinate.
What I would like to know from others that have been creating games for a while is:
Am I ok with subclassing the SpriteList?
If so, is it just overriding Update() and iterating through the list of sprites and updating the coordinates?
If not, what kind of approch is standard for this? Any places on the web that you can direct me too? I am self motivated so you kick me in the correct direction and I will be on my way.
Any help is appreciated,
Mike
Solved! Go to Solution.
on 05-09-2012 01:29 AM
Deriving from SpriteList and providing an implementation of Update looks like it should work. Depending on the kind of game you're building you might want to use the Update method on the individual sprites (it looks like if you derive from SpriteBase you can provide your own per-sprite Update method). Note that it looks like you may need to call ScheduleUpdate to actually get Update called at the appropriate times.
PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.
フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと
PSM DevPortalを一度ログアウトし、再度ログインしてください。


Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870