Author Topic: multiple 2-player maps  (Read 7869 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: multiple 2-player maps
« Reply #15 on: 2006-02-06, 09:22:29 PM »
There are several ways to make that work I believe.  One is to have an inventory item that increases by 1 automatically every frame (global function) and have a max of 1 or 2, initial of 0.  Then, another special function (global) activates that requires 1 (or 2) of the inventory and is removed on use, which plays the modal sound

OR, you could create an invisible sprite that has a 1-frame delay with an initial instance, and have it activate a special function at the end of the path that plays the modal sound (and deletes the sprite).  This requires no inventory to be added, happily enough.

Both of these don't use any script.  Also, it would be a good idea would be to put a short delay at the beginning of the audio file so it doesn't start playing too quickly.
« Last Edit: 2006-02-06, 09:25:55 PM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: multiple 2-player maps
« Reply #16 on: 2006-02-07, 07:22:50 AM »
I have a couple suggestions for a couple possibilities:
1. If you want to allow different sprites to act at the player 2 sprite, you should maybe settle on every player2 sprite starting with the word "Player2" and make sure no other sprites start with "Player2".  Then change this line:
Code: [Select]
If oLayer.Sprite(i).rDef.Name = "Player2" Then intSprTwo = ito this:
Code: [Select]
If Left(oLayer.Sprite(i).rDef.Name,7) = "Player2" Then intSprTwo = i
You might have to figure out a way to reset intSprTwo to -1 when player 2 switches sprites.  Maybe have the special function raise an event and in the Player_OnSpecialFunction function, set intSprTwo = -1.  For that matter you could probably just locate the index of the new player sprite right there instead.  There are many ways to handle it.

2. If there will ever be a time where there is no player 2 sprite active, add this line before the "With oLayer.Sprite(intSprTwo)":
Code: [Select]
If intSprTwo >= 0 Thenand add this after the End With:
Code: [Select]
End If