Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - cbass

Pages: [1] 2 3 ... 7
General Discussion / Re: A sample project
« on: 2007-03-31, 06:35:59 PM »
I tried to unzip it with winwip, winrar, ultimate zip, and windows xp unzipped.  None worked, finally 7zip worked.

Cool, I didn't know 2.0 was so far along, I always assumed it was years off.

Off-Topic / Re: Final Fantasy 12
« on: 2006-10-31, 03:39:05 PM »
beat it. :D

actually i might get it.  is it on PC?  Last FF i beat was 6 (3 US)

Help/FAQ / Re: Enemies Shooting Back
« on: 2006-10-30, 07:52:56 AM »
8 state sprites can go in more than 8 directions.  Its just a matter of finding the vectors to start them off in, which usually requires script or paths.

(cool, when did this forum get spellcheck :) )

Help/FAQ / Re: How do i upload my games?
« on: 2006-10-16, 05:19:58 PM »
Thank you for participating in our Gmail beta program.  We are ready to go live with Gmail, and are pleased to announce that you can keep your same email address!  All accounts start fresh, but with no more "old" beta emails cluttering them, so you get the full storage space again!

-The Gmail management team

 ;D Hehe.  I've had gmail for about a year and a half, but it says I'm not even using 1 meg of it yet.  I think i'm just doing good on keeping it away from spammers and buisnesses.

Script / Re: Integer velocities?
« on: 2006-10-13, 10:33:18 PM »
dx and dy are a "single" type which is a 4 byte floating point I believe.  which means yes it can be fractions of an integer

So they can be:


Script / Re: editing trans layer
« on: 2006-10-12, 07:12:07 PM »
Off topic. ;D


This could be really useful in some situations, to avoid mass tile changes on a map.

Cool, I wonder why I never noticed this one before, I do a lot of work with TileValue(X, Y) and alway assumed it was the absolute byte stored in map file.  But reading the peice on TileMapping, Tilevalue can change for a given X,Y if the cell is animated.  How do you determine what is stored in map file (RealTileValue) for a particular X,Y if you are reading TileValue on an animated tile?  Don't have a problem at the moment, was just wondering for future reference. ;)

Script / Re: editing trans layer
« on: 2006-10-12, 07:02:08 PM »
I can independantly confirm that 0 is the furthest background layer, and the highest number is the foreground layer.

I dont think "Alter Map" will work on anything but the player sprite's layer.

Script / Re: editing trans layer
« on: 2006-10-11, 09:35:18 PM »
Can't quite visualize what your planning.  But to help you with some info:  Sprites can be drawn partially off the map if they hang off the right or bottom edge of the map, but not the top or left edge  (x,y positions can't be negative as far as I know)

Script / Re: the targeter... hehe,sorry...
« on: 2006-10-11, 06:58:51 PM »

or for the player sprite:

Or for any abitrary sprite on the same layer as the playersprite, say your Target sprite:
Where SPRITENUM is the index number of your sprite, which can be found like this:

Code: [Select]
For i = 0 to ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer.SpriteCount-1
  If ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer.Sprite(i).rDef.Name="Name of Sprite"
    'Where "Name of Sprite" is what you typed in SGDK interface"
    Exit For
  End if
Next i

You can also use HostObj somehow to save the sprite object instead of always having to look for the index, but I forget how to do that in vbs.

Also here is the function for finding angle between 2 points in radians (X and Y are the diffrences of the 2 points:
Code: [Select]
Public Function Atan3(ByVal X As Double, ByVal Y As Double) As Double
' This function was kindly provided by Blindwig of the Extreme Visual Basic Forum.
' Returns an angle in radians, appropriately adjusted for all 4 quadrants
    Select Case X
        Case Is > 0
            If Y >= 0 Then
                Atan3 = Atn(Y / X)
                Atan3 = Atn(Y / X) + 2 * PI
            End If
        Case 0
            If Y >= 0 Then
                Atan3 = PI / 2
                Atan3 = 3 * PI / 2
            End If
        Case Is <= 0
            Atan3 = Atn(Y / X) + PI
    End Select
End Function

Script / Re: editing trans layer
« on: 2006-10-11, 06:35:16 PM »
So let me get this straight.  You want to edit a layer at runtime with script, this is possible.  You can't move a layer left or right, or even up and down.  all layers are aligned to the top left corner of the map and scroll from there. (The top left pixel of every layer are always stacked on each other perfectly)  If you make the scroll rate zero then the layer covers the whole screen and doesn't scroll ever.  (remember use Map and not MapEdit since MapEdit is only for when you open the map editor in the SGDK design environment.)

As far as doing a day and night sequence, I don't think it is possible, since there is no alpha transparency supported.  The only way I could see doing something remotly like making a darker tint would be to make a tiles set with 2 tiles each 640x480 one transparent, one darker (or dithered darker/transparent), and then make a tile animation that switches between them once/frame.  Then, make the top layer of your map scroll rate=0 and use this tileset.  Then with script, change the value of that tile depending on if it is day or night.

It would probably look pretty bad, but could work (would probably look a lot better if you made the tileset 3 tiles, and had two of them dithered opposite and cycled between them at night)

Script / Re: the targeter... hehe,sorry...
« on: 2006-10-11, 01:07:31 PM »
I don't have time for a detailed reply, but I can tell you that that code is nowhere close to working yet.

Changing the TargetSprites positition should be within the if blocks if a buttons pressed.
The if blocks are wrong for determining whether a button is being pressed or not.  See almost any example script for correct way.
Also, need to end ifs with and "end if" line

The AngleRadians  thing is kinda screwed up.  You need a separate function.  Either lookup in a VB forum for a function to convert 2 coordinates to the angle between them in radians, or I think I have one and can post it later.

Also, you have to define TargetSprite somehow and I don't see how that is done.

Projects / Re: New Game
« on: 2006-10-09, 11:21:10 PM »
off the top of my head.  have some kind of special function with the player-pencil collision that destroys and remakes the playersprite.  putting him as the last sprite, so he is drawn last each frame (on top).  Or just make is a series of tiles.

as far as walking down the incline of the pencil.  My only solution would be to make it out of tiles and place accordingly with the apporoprite uphill downhill types established.  While leaving it a single sprite, I can think of no simple way to script the effect you discribe.

News and Announcements / Re: SGDK 2.0 Status
« on: 2006-09-25, 04:31:57 PM »
sounds like a good solution.  I like the idea of keeping more stuff global instead of properties of a tilsets/layers/maps.

You going to stay with 256 tiles per tileset or up the maximum to 65536? (or somewhere in between)

Script / Re: Sword Script
« on: 2006-09-24, 11:46:28 PM »
I think i made the correct changes (i think), but I couldnt test it becuase when I went to find the original sample from the gameprojects link on main page, I kept getting rerouted to google.

Tell me if it works or not.

GRRRRR, also it wont let me upload the file.  Here is the txt from the file.

Code: [Select]
' File: sprite stuff.vbs
' Description: Facilitates sword and magic use for player. Also switches sprites for player sprite with code instead of Map Special Functions
' Programmer: Mark Ribau (original shooting code be Ben Marty)
' Documentation: See each function for a description of its use

Dim nExpectCount 'number of sprites to expect in
Dim nShot0Count 'number of sword sprites
Dim arBtn0Shots(0) 'sword sprites

Dim nButton0State

'generated by wizard
'watches for button/key press by player
Sub Player_OnControllerMove(OldActions, NewActions)
   If (Not OldActions) And NewActions And ACTION_BUTTON1 Then nButton0State = 1
   If (Not NewActions) And ACTION_BUTTON1 Then nButton0State = 0
End Sub

'generated by wizard
'apprears to remove references to sprites that are not on screen/in existence
Sub RecountShots()
   Dim nSIdx, nLIdx
   With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
      nSIdx = 0
      Do While nSIdx < nShot0Count
         For nLIdx = 0 to .SpriteCount - 1
            If arBtn0Shots(nSIdx) Is .Sprite(nLIdx) Then
               Exit For
            End If
         If nLIdx >= .SpriteCount Then
            Set arBtn0Shots(nSIdx) = arBtn0Shots(nShot0Count - 1)
            nShot0Count = nShot0Count - 1
            nSIdx = nSIdx + 1
         End If

      nExpectCount = .SpriteCount
   End With
End Sub

'generated by wizard
'removes a sprite from the layer/screen
Sub RemoveShot(Spr)
   Dim nIdx
   With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
      For nIdx = 0 to .SpriteCount - 1
         If .Sprite(nIdx) Is Spr Then .RemoveSprite(nIdx) : Exit Sub
   End With
End Sub

'originally generated by wizard; modified/debugged by Mark
'returns the appropriate "velocity" for a magic attack based on PlayerSprite's state
Function GetStateDeltas(DX, DY)
   With ProjectObj.GamePlayer.PlayerSprite
      Select Case .rDef.Template.StateType
         If Abs(DX) + Abs(DY) > 1 Then
            DX = .DX / Abs(.DX) + Abs(.DY)
            DY = .DY / Abs(.DX) + Abs(.DY)
            If Abs(DX) + Abs(DY) < 1 Then DX = 0 : DY = -1
         End If
         DY = 0
         If (.CurState mod 2) = 0 Then DX = -1 Else DX = 1
         Select Case (.CurState mod 8)
         Case 0 : DX = 0 : DY = -1
         Case 1 : DX = 1 : DY = -1
         Case 2 : DX = 1 : DY = 0
         Case 3 : DX = 1 : DY = 1
         Case 4 : DX = 0 : DY = 1
         Case 5 : DX = -1 : DY = 1
         Case 6 : DX = -1 : DY = 0
         Case 7 : DX = -1 : DY = -1
         End Select
      Case Else
         DX = Cos((.CurState mod 36) * 3.14159 / 18)
         DY = -Sin((.CurState mod 36) * 3.14159 / 18)
      End Select
   End With
End Function

'orginally generated by wizard; modified by Mark
'deals with particularities of each sprite before each frame is drawn, see internal documentation for more information
Sub Player_OnAfterMoveSprites
   'setup some values for screen
   Dim nIdx, VLeft, VTop, VRight, VBottom, VDat
   With ProjectObj.GamePlayer
      VLeft = .MapScrollX
      VTop = .MapScrollY
      VRight = VLeft + .rMap.ViewWidth
      VBottom = VTop + .rMap.ViewHeight
   End With

   If nButton0State > 0 Then DoFireButton0

   If nExpectCount <> ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer.SpriteCount Then RecountShots
'if player is attacking with sword
    if nShot0Count = 1 then
'check if the last frame of the sword is being displayed, if true, remove sword sprite, change player sprite to non-attacking sprite
If arBtn0Shots(0).CurFrame = arBtn0Shots(0).rDef.StateFrameCount(arBtn0Shots(0).CurState) - 1 then
RemoveShot arBtn0Shots(0)
nShot0Count = 0
nExpectCount = nExpectCount - 1
SwitchPlayerSprite "Player1Copy"
'Set ProjectObj.GamePlayer.PlayerSprite.rDef.Template = ProjectObj.GamePlayer.rMap.SpriteTemplates("Player")
'if false, fix direction (state) of sword sprite with respect to player sprite
'and move the sword sprite to appropriate location based on player sprite location
GetStateDeltas DX, DY
With ProjectObj.GamePlayer.PlayerSprite
arBtn0Shots(0).CurState = (.CurState mod 8)
If DX = 0 Then
arBtn0Shots(0).X = .X + (.Width - arBtn0Shots(0).Width) / 2
ElseIf DX = -1 Then
arBtn0Shots(0).X = .X - .Width
ElseIf DX = 1 Then
arBtn0Shots(0).X = .X + .Width
End If

If DY = 1 AND DX = 0 Then
arBtn0Shots(0).Y = .Y + .Height
ElseIf DY = 0 Then
arBtn0Shots(0).Y = .Y + (.Height - arBtn0Shots(0).Height) / 2
ElseIf DY = -1 AND DX = 0 Then
arBtn0Shots(0).Y = .Y - .Height
arBtn0Shots(0).Y = .Y + (.Height - arBtn0Shots(0).Height) / 2
End If
end with

end if
end if

   'manually advance animation frame of sword (due to an error in 1.2.3 -- motion/animate speed integrated)
   'NOTE: unnecessary looping involved: to be modified
   Dim nAnimIdx
   For nAnimIdx = 0 to nShot0Count - 1
      arBtn0Shots(nAnimIdx).AdvanceFrame 1
   If nExpectCount <> ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer.SpriteCount Then RecountShots
   nIdx = 0

End Sub

'originally generated by wizard; heavily modified by Mark
'deals with attacking with sword, see internal documentation
Sub DoFireButton0()
   Dim NewSpr, DX, DY

   nButton0State = nButton0State + 1
   If nButton0State < 20 And nButton0State > 2 Then Exit Sub Else nButton0State = 2

   'check for how many sword attacks there are on screen, if 1 or more, exit sub (so another sword attack will not be created)
   If nShot0Count >= 1 Then Exit Sub

   'create a sword sprite
   Set NewSpr = ProjectObj.GamePlayer.rMap.SpriteDefs("Sword").MakeInstance
   Set arBtn0Shots(nShot0Count) = NewSpr
   nShot0Count = 1
   With ProjectObj.GamePlayer.PlayerSprite
      .rDef.rLayer.AddSprite HostObj.AsObject(NewSpr)
      nExpectCount = nExpectCount + 1

      'set swords velocity to 0 (flying sword kind of odd in this case--though, this could be useful in a Zelda-esque charged sword situation)
      GetStateDeltas DX, DY
      NewSpr.DX = 0
      NewSpr.DY = 0

'use DX and DY to determine the placement of sword sprite with respect to player sprite     
If DX = 0 Then
NewSpr.X = .X + (.Width - NewSpr.Width) / 2  'center sword horozontally
ElseIf DX = -1 Then
NewSpr.X = .X - .Width 'put sword on left
ElseIf DX = 1 Then
NewSpr.X = .X + .Width 'put sword on right
End If

If DY = 1 AND DX = 0 Then
NewSpr.Y = .Y + .Height 'put sword on bottom
ElseIf DY = 0 Then
NewSpr.Y = .Y + (.Height - NewSpr.Height) / 2  'center sword vertically
ElseIf DY = -1 AND DX = 0 Then
NewSpr.Y = .Y - .Height 'put sword on top
NewSpr.Y = .Y + (.Height - NewSpr.Height) / 2  'center sword vertically
End If

if ProjectObj.GamePlayer.PlayerSprite.CurState > 7 then
      arBtn0Shots(0).CurState = ProjectObj.GamePlayer.PlayerSprite.CurState - 8
arBtn0Shots(0).CurState = ProjectObj.GamePlayer.PlayerSprite.CurState
end if

'change the player sprite to an attacking sprite
SwitchPlayerSprite "Player1Jab"
'Set ProjectObj.GamePlayer.PlayerSprite.rDef.Template = ProjectObj.GamePlayer.rMap.SpriteTemplates("PlayerJab")

   End With
End Sub

'generated by Wizard
'appears to change from X & Y velocities to "polar" state (36 state)
Function RectToPolarState(X, Y)
   Dim Angle, Pi
   Pi = 3.14159
   If X <> 0 Then
       Angle = Atn(-Y / X)
       Angle = -(Pi / 2) * Sgn(Y)
   End If
   If X < 0 Then
       Angle = Pi + Angle
   ElseIf Y > 0 Then
       Angle = Pi * 2 + Angle
   End If
   RectToPolarState = ((Angle * 18) / Pi) Mod 36
End Function

'catches special functions from map, both are called by collision definitions
'the "Kill" special function is used to add 1 to kill inventory item
'the "Die" special frunction is used to remove 5 HP from player, and then at 0 HP display a "game over" screen
Sub Player_OnSpecialFunction(SpecialFunction)
If SpecialFunction.Name = "Kill" then
ProjectObj.GamePlayer.InvQuantityOwned(1) = ProjectObj.GamePlayer.InvQuantityOwned(1) + 1
end if
if SpecialFunction.Name = "Die" then
ProjectObj.GamePlayer.InvQuantityOwned(0) = ProjectObj.GamePlayer.InvQuantityOwned(0) - 5
If ProjectObj.GamePlayer.InvQuantityOwned(0) = 0 then
ProjectObj.GamePlayer.ActivateFunction ProjectObj.Maps("Map").Specials("Game Over")
ProjectObj.GamePlayer.bQuit = True
End If
End If

End Sub

'switches player sprite from one sprite to another based on the name of the new sprite
Sub SwitchPlayerSprite(NewSpriteName)
       Dim NewSpr
       Dim Idx
       Dim MyState
       MyState = ProjectObj.GamePlayer.PlayerSprite.CurState
       With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
             Set NewSpr = .pMap.SpriteDefs(NewSpriteName).MakeInstance
             NewSpr.X = ProjectObj.GamePlayer.PlayerSprite.X
             NewSpr.Y = ProjectObj.GamePlayer.PlayerSprite.Y
             For Idx = 0 to .SpriteCount - 1
                   If .Sprite(Idx) Is ProjectObj.GamePlayer.PlayerSprite Then
                         .RemoveSprite Idx
                         Exit For
                   End If
             Set ProjectObj.GamePlayer.PlayerSprite = NewSpr
       End With
       ProjectObj.GamePlayer.PlayerSprite.CurState = MyState       
End Sub

'required code to work (attaches script to project at runtime)
HostObj.SinkObjectEvents ProjectObj.GamePlayer, "Player"
ProjectObj.GamePlayer.Play 16

Off-Topic / Re: Installer
« on: 2006-04-19, 06:34:24 PM »
generally .bmp files compress very very well (so do gamedev .map files), so getting 1.5 meg to 80k sounds about right for a gamdevgame.  (i think one of my projects was 8 or 9 megs installed but only 270 k zipped)

Pages: [1] 2 3 ... 7