Scrolling Game Development Kit Forum

SGDK Version 2 => Help, Errors, FAQ => Topic started by: blink3 on 2008-08-19, 10:21:16 AM

Title: <- Nub Need Help
Post by: blink3 on 2008-08-19, 10:21:16 AM
hey pplz, ok well i set the gravity and everything and react to solid on my player, the solidity and tile category and stuff, so i just want to test how it is so i make a little solid area and place my sprite on top and then i press F5 and i enter and i just fall through it, if you want to see my file i can send it to you, thanks!
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-19, 10:37:22 AM
check your player rules: ReactToSolid must come right before MoveByVelocity.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-19, 10:46:07 AM
it already is :( and one more thing i come up with an error "Stack Empty" when i try to run my "game"
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-19, 10:59:33 AM
"stack empty" occurs always when you have somewhere an "end"-rule too much. no big thing. happens from time to time.  ;)
and move your player a little bit higher on your map.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-19, 11:30:01 AM
my sprite character is at the highest point it can be on the map, so hopefully theres other options and you know what to do :P!
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-19, 11:56:19 AM
i suppose you have followed the "first steps" help files. maybe you want to read through them another time.
if you have a place to upload your file, maybe i will take a look at it  ;D
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-19, 12:04:48 PM
yeah ill try to read the first steps again, i read it a bunch of times already and it hasnt helped but heres the link plz have a look http://rapidshare.com/files/138543475/3rd_Game.sgdk2.html thanks :D i really want to get used to sgdk2
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-19, 04:54:28 PM
well the steps didnt work for me again so... i dunno
Title: Re: <- Nub Need Help
Post by: durnurd on 2008-08-19, 08:13:40 PM
Make sure:

The tiles you placed are in the Solid category
The sprite you placed has the Solid category selected as its solidity definition (select the sprite and look at its properties window.  You may need to scroll down to see the solidity dropdown list).
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-19, 08:22:33 PM
You have way too many rules between ReactToSolid and MoveByVelocity.  There should be nothing between these rules, otherwise the velocity calculated by ReactToSolid will be overridden by the other rules.  Specifically, you should not have Accelerate and Gravity rules between ReactToSolid and MoveByVelocity.  That will override the "reacted velocity" calculated by ReactToSolid.  (Your "ReactToSolid" rule is not right before MoveByVelocity as you said earlier.)
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-19, 08:40:17 PM
ok well my sprite seems to react to solids more but it still does NOT land on a tile it just falls down it like stairs
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-20, 04:27:42 AM
okay, this is easy to fix.

#1: move "moveByVelocity" right under "reactToSolid" in both your sprite definitions.
#2: deactivate or delete the two unneccessary rules "End if" and "End climbing" in your Chocobo 1. They are not needed because you have already set a checkmark at "End" at the rule before. you can deactivate with the button right beside the two arrows.
#3: your chocobo on the map has no solidity set. select it (at the layer editor) and look down where a lot of parameters are. there is one called Solidity, click into the empty field beside it and select "Standard".
#4: you need one rule that allows you to control the player with the keyboard. Select the folder "plans" of your layer. create a new plan and in it a new rule. choose "MapPlayerToInputs", set PlayerNumber = 1 and Target = m_ParentLayer.m_Player
#5: look at the moving rules of Chocobo 1. There is "Player.State.Right" instead of "Chocobo1.State.Walk_Right_". This happened because you first defined the rules, and then renamed the sprite and the states. This rules have to be changed then again. change the other moving rules too.

that is supposed to be all by now. the game is running here.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 08:55:20 AM
thanks all of you this is a great community, man i love ya, time to work on the map now so it can look good
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 10:28:47 AM
OMG! i made the game work thanks to you guys, i saved and exited, then i opened it up again later when i wanted to make more stuff and its back to "falling down the stairs" when i load the game, everything is still changed to how it should be running besides the sprite's solidity and when i change that i load the game and my character bursts into the air and stays there, so Tanja could you post your fixed version of my game? ty i kinda feel really stupid cuz im pretty sure this should be easy to fix
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-20, 10:53:45 AM
i don
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 10:59:40 AM
i dont really understand it either, but thanks anyways
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 11:30:43 AM
do you mind if i ask 1 more thing? ok well how do you make it so you die if say Example ->   ____     ____  say there is 2 pieces of land and a gap between them, how would you make it so that when they fall through they would Die like in      |   |              Super Mario? Also, nvm i ask you too much questions
                                                                                                                                      |    |
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-20, 11:41:38 AM
you could make an extra tile, perhaps a transparent one, that you put into the gaps. this tile would be in a tile category named "deathly" or so, and then you could make rules that ask if the player touches the category.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 12:03:10 PM
so would i make the death gap "tile category : touchable" or would i make it a sprite? if it was a tile category would i have to edit the rules in the map?
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-20, 12:29:29 PM
they need their own category, that would be the simpliest. the sprite needs a rule "touchTiles".
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-20, 12:49:39 PM
im sorry but i dont understand "they need their own category and needs a sprite rule?
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-21, 09:20:13 AM
i believe this must be described somewhere in a tut.
you can make a tile category for the deadly tile which is at the bottom of the gaps. your player needs a rule (do TouchTiles). this checks wether the player touches the deadly tiles. of course you need some more rules to tell what shall happen than.
perhaps you should look at sample game. the players use touchTiles to collect the fruits.

you could of course achieve the same with a sprite, this would also be used to make enemies .
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 10:58:31 AM
yeah, do u know a rule to restart level? cuz i've been looking and couldnt find one
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-21, 11:42:37 AM
this is a very tricky thing (to me). maybe some more experienced coder could help here.  i would be very glad if a good, clean restart-option would be available in sgdk2 some time.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 02:26:00 PM
yeah i sent a PM to blue hopefully he'll get it and pm me!
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-21, 02:34:27 PM
i believe he reads your posts here already. and from a public answer more people would benefit.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 02:38:47 PM
ok, well i hope he does that then :P
Title: Re: <- Nub Need Help
Post by: Jam0864 on 2008-08-21, 03:31:41 PM
don't you just use a changemap rule, and then switch to the map your already on? i thought that would reset it.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 03:33:03 PM
oh maybe ill try that
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 05:46:18 PM
ok i set the transparent tile into Tile Category: Touchable,
In the PLayer rules it looks like:
Rule1 - IF IsOnTile
TileCategoryName.Touchable
RelativePosition.CenterMiddle

Rule 2- DO SwitchtoMap
typeof(Pococo_Map)
false

is that good? also when i set my gap my sprite doesnt fall into the gap if it looks like this ___    ___ The sprite will just move over it like it was a
                                                                                                                              |   |      Solid.

Title: Re: <- Nub Need Help
Post by: durnurd on 2008-08-21, 05:53:04 PM
If the gap is close to the same width as the sprite, the sprite will likely just glide right over the hole.  If you make the hole larger, the sprite is more likely to fall into it.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 07:51:59 PM
ok and about the restart level transparent tile is that a good rule cuz its not working
Title: Re: <- Nub Need Help
Post by: durnurd on 2008-08-21, 07:56:43 PM
I really don't understand what your last post was meant to say.  Can you state it more clearly?
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-21, 08:27:53 PM
in the recently stated rule would you think that it is a rule that would be able to work? If it should work its weird cuz mine doesn't
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-22, 05:22:24 AM
I thought resetting a level would be relatively easy.

IncludeInSaveUnit - SaveUnitInclusion.AllMaps
SaveGame - Slot = 1, InMemory = true

LoadGame - Slot = 1, InMemory = true
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-22, 05:24:01 AM
OMG! i made the game work thanks to you guys, i saved and exited, then i opened it up again later when i wanted to make more stuff and its back to "falling down the stairs" when i load the game, everything is still changed to how it should be running besides the sprite's solidity and when i change that i load the game and my character bursts into the air and stays there, so Tanja could you post your fixed version of my game? ty i kinda feel really stupid cuz im pretty sure this should be easy to fix

I suspect that you fixed some things, saved the project, then fixed some more and ran the project, but didn't save it.  So the compiled project worked, but after you exited and loaded the project again, some changes were lost.  I don't know how else to explain it.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-22, 01:43:13 PM
blue how do i make the player "die" do you mean when he touches the "touchable" transparent tile?
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-23, 08:12:07 PM
Yes, that would be to make the player "die" when touching a deadly tile.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-24, 03:33:43 PM
Blue I cant get it to work,
The Transparent Tile is set in my Deadly Category,
Its On My map between  a gap
I'm able to fall into the gap and what i expected to happen ( teleport back to the beginning of the map) didnt, i fell through the gap and my sprite just sat there at the bottom of the map.

Now Im going to show you my Sprite Rules
Do - IncludeInSaveUnit - SaveUnitInclusion.AllMaps

Do - SaveGame - Slot = 1, InMemory = true

Do - TouchTiles - Category = TileCategoryName.Deadly

Do - LoadGame -Slot = 1, InMemory = True

Is there a tutorial on this? I know your busy so im sorry for asking you for so much.
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-25, 05:21:06 AM
You shouldn't save the map when you fall through the gap, only load it.  If you save it when you fall through the gap, then loading it will, of course, put you right back in the gap.  Save should be done once when the game/map starts, then load to reset to that state when the player dies.  Also, you need to use an "if" rule to test whether one of the tiles that the player touched was deadly.  "Do" will always just do the action no matter what.

I don't think there's a tutorial for this yet, but you can look at the sample project and try to understand how its rules are working.  It doesn't demonstrate loading the game, but it does demonstrate using "If" rules and TouchTiles.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-25, 11:07:40 AM
i dont understand, my save game rules are up at the top just under move by velocity and my load game rules are 6 rules down so how is it saving when i fall through the gap?
Title: Re: <- Nub Need Help
Post by: Jam0864 on 2008-08-25, 03:32:01 PM
because all your asking the computer to do is

Do - IncludeInSaveUnit - SaveUnitInclusion.AllMaps

Do - SaveGame - Slot = 1, InMemory = true

Do - TouchTiles - Category = TileCategoryName.Deadly

Do - LoadGame -Slot = 1, InMemory = True

As bluemonkmn explained, when something is set as "do" the computer just does it, no questions asked. so telling the computer what to save by the look of the first rule, then its saving, then its declaring the touchtiles "deadly" category, then its gonna load. Before load, you have to put a rule, IF sprite is touching tile in category deadly, then load. (Otherwise when u start the map it will just save load save load save load save load before u can even play the game!) it has to be IF, because IF asks the computer if something is happening or not, and will only continue if it's true.
Title: Re: <- Nub Need Help
Post by: bluemonkmn on 2008-08-25, 05:22:55 PM
The rules that you define on the sprite rules tab are rules that execute every time a sprite of that type is drawn.  So every time the player is drawn (60 times per second) it's going to save and load the game unless you have some condition that limits when to perform these actions (like a counter), and then (for example) only perform it when the counter is a specific value, and then change the counter to something different so it doesn't happen again.
Title: Re: <- Nub Need Help
Post by: blink3 on 2008-08-26, 09:32:28 AM
since im gonna try to learn as much as i can from this thread, how exactly do counters work in sprite rules.
Title: Re: <- Nub Need Help
Post by: Tanja on 2008-08-26, 10:07:48 AM
one thing i can recommend to you, start to read the help files from start to finish and then again. no joke, you can learn so much there. for example the counters. you can read how counters work, what they do and how all the functions are named and what they are for. the help will you provide much faster with information than this forum can.