I am thinking about making the platformer starter kit distributed by Microsoft XNA studio; into a local platformer game.
I'm trying to figure out how to add another player in the game so that there are two players.
Has anyone done this before or know how to do this?
thanks
You would need to have a second player object that you would track separately from the first player object. Then you would need to respond to controls from the second controller, or a separate set of keyboard input than the first player object.
To get the controls for the second player (using the Xbox 360 controller) you could use:
GamePad.GetState(1); // 1 is the index, so it refers to player 2.
MSDN
Related
I'm working on an iOS application that works with different pieces of audio. Each piece of audio is tied to a separate button (similar to the kind of functionality you'd see in a soundboard app).
In a simple soundboard application, you've got an instance of a player object (AVAudioPlayer or an AVAudioEngine player node) that gets fired whenever a button is pressed.
If you push buttonOne, then sound1 plays.
If you push buttonOne again while sound1 is still playing, then the current instance is interrupted and "replaced" with a new instance of sound1 that starts over at the beginning.
If you push buttonOne, THEN push buttonTwo before sound1 is finished, the instance of sound1 is interrupted and replaced with sound2, again, played from the beginning.
Suppose you're trying to enable cross-fading between the two sounds. You can just create two player instances, load the first sound into player1 and the second into player2, and cross fade between them.
Building on that, suppose you're trying to allow different combinations of sounds to play at the same time. Either the idea that a large number of sounds (maybe the whole soundboard) can all play without interrupting each other. Or, perhaps, the ability to have multiple sounds playing at the same time, e.g. sound1 is a music bed, and sound2...soundXX are sound effects that should be able to play over the music bed without interrupting it.
QUESTIONS: what is the best design strategy for managing your player instances in this situation? Suppose you have a 5 x 5 grid of buttons in your soundboard. If, hypothetically, you should be able to play all 25 sounds at the same time, would that require you to init 25 player instances at setup? (this seems very anti-DRY and not particularly efficient). Or is there some way to dynamically manage the number of instances you need (maybe with a lazy variable?) so that additional instances are only generated as needed, e.g. when you have x number of sounds playing and you start another, an additional instance is generated to contain the newly added sound?
what is the best design strategy for managing instances of AVAudioPlayer in this situation
None. You should be using AVAudioEngine. That's exactly what it is, a sound board / patch kit.
Or is there some way to dynamically manage the number of instances you need
If I have 25 ordered instances of a thing where one possibility is no instance at all, that sounds like an array of Optionals.
I'm developing an iOS app using swift, in this app I want monitor several IP camera in the same view.
I created two VLCMediaPlayer and feed them with two different rtsp link and both of them result in extremely lag. I've also change the "network-caching" to 10000 for both two VLC Player. If I use just one VLCMediaPlayer in that view, the streaming is fine.
I'm wondering is this the right solution for display multi-vlc player? Or I should use other solution or other media player?
I am building a 2 player game. I am using GKTurnBasedMatchmakerViewController to start matches. I would like to ensure that players can only have one game vs the same player.
Currently if a player starts a game with someone they already have I just delete the game. This has 2 issues
The other player gets notifications about the newly deleted game
If the game was created by auto-match then the other user is removed from the auto-match queue.
So I would like to know...
Is there a way to exclude players in the GKTurnBasedMatchmakerViewController
Is there a way to remove a player from a game that allows the game to look for a new auto-match player?
This question already has answers here:
Multiple Video, Same Screen
(3 answers)
Closed 9 years ago.
I need to show two different videos at the same time within my iOS app. One video needs to be playing in the top half of the screen, and a separate video needs to be playing on the bottom half of the screen. I don't need to have the stop/play/ffw/rew buttons enabled - just to show the videos playing. I have some of my own buttons to stop and start playback, which should affect both videos.
I tried using two MPMoviePlayerController views, but it will only allow one to be playing at any one time. I read that it's possible to have two playing in separate ViewControllers - if so, do I simply need to create two UIViewControllers and add them to the parent viewcontroller?
Thanks for your help guys!
That is not possible on any multimedia framework level.
AVFoundation- (AVPlayer) and MediaPlayer-Framework (MPMoviePlayerController) both only support a single video playback at a time.
Update
The situation has changed. In fact, AVFoundation does permit multiple movie playbacks at a time. MediaPlayer still sticks towards the single playback at a time restriction.
You can obtain AVPlayer to implement controllers and interfaces for multiple instances of AVPlayerLayer. These may be added to the layer hierarchy, so it is very possible to have multiple videos on one screen at the same time.
Here is an overview of one approach with accompanying sample code.
I have multiple MPMoviePlayerControllers in one view.
When a play one of them while there is already another one is playing,
the playing one is "Paused"(I'm not sure the real state it is, but more like "Stucked")
How can i know which one of the MPMoviePlayerControllers is Stucked?
Its restriction by apple, in single view controller only single movie player will get played. If one player is in play state and you are trying to play another then first player will get in pause/stop mode.