Author Topic: .net mag Tutorial  (Read 1720 times)

arcade27

  • Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
.net mag Tutorial
« on: Sat, Jul 23, 2011 »
Ok Firstly I would like to say,  Great Tutorial,  It got me into using Flixel.  Only thing missing is regarding Chabging between levels.  Which we quickly worked out our self.


By Replacing Line 70 of Playstate.as

Code: [Select]
private function changeState():void
{
FlxG.switchState(new PlayState2);
}


What were having issues with is With Making the 'exit' area.  We have changed the vallues we assumed delt with this and it failed...
SO!  help would be nice :3

So far we have changed

Level1.as^line 31
Code: [Select]
Registry.levelExit = new FlxPoint(12* 6, 16 * 16);
We assumed this code Placed the 'overlap' Destination,  so when the character walks here he moves to level 2

We allso changed acrodingly


Level1.as^line 58 - 64
Code: [Select]
public function openExit():void
{
// Removes the two blocking tiles on the right of the map and sets them to nothing, so the player can walk through
map.setTile(12, 6, 0, true);
map.setTile(13, 6, 0, true);
}


Yet when the character moves to 12 * 6 ,  The Next level isnt loaded D:




arcade27

  • Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: .net mag Tutorial
« Reply #1 on: Sat, Jul 23, 2011 »
Ok so replying to myself is not cool but mea XD

In the end i created a new object

Door.as

Using the Same Collision Methods as Star.as But Calling Change state on collisions,  works :3

HOWEVER !  if theres a better way do tell xD

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: .net mag Tutorial
« Reply #2 on: Sun, Jul 24, 2011 »
I didn't have privileged of reading Richard's tutorial, since they don't sell that magazine in my country, but I think it is what you are looking for:

flxg.state = new yournext level.
If you want to be awesome, just restart the playstate, and have the playstate contain multiple levels that get loaded based on a variable. I recommend using flxG.level as the variable, seeing as thats what its there for.
blog, twitter, Check out my award winning game, Rot Gut:

GrimPanda

  • Member
  • **
  • Posts: 46
  • Karma: +1/-0
    • View Profile
    • Grim Panda Games
Re: .net mag Tutorial
« Reply #3 on: Sun, Jul 24, 2011 »
Ok Firstly I would like to say,  Great Tutorial,  It got me into using Flixel. 

Welcome to Flixel ! :o)
"Mortis Ailuropoda"

arcade27

  • Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: .net mag Tutorial
« Reply #4 on: Sun, Jul 24, 2011 »
@Grimm ,  thanks
@Test,  thats what i was looking for cheers. 

and yea,  the tutorial is actualy relay good,  there's also enough images extra not used in the tutorial to play around with,  such as life sprites.
Weave pretty much just been reverse engineering and working from that.

Were now using an item instead of the door element that the tutorial suggests use.  Mainly becuse the tutorial assumes the door will always be on the far right.
The othly other 'big' issue we have hit is with collisiosns and tile sets -.- ;;  we where trying to use a triangle image in our tile set,  i assume we need to use sprites instead ?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: .net mag Tutorial
« Reply #5 on: Sun, Jul 24, 2011 »
Hiya,

Glad you liked the tutorial and are enjoying the extra sprites and tiles.

About the exit. The FlxPoint that is created sets the top left corner of the exit area. Basically it checks the players x/y coordinates, and if the player has an x > than the level exit x, and y > level exit y, then it knows they have left the level. The x/y coords were placed to be where those 2 stones are removed once all the stars are collected, so you know that if the player coordinates are beyond that x value, they must have opened the door.

To be honest it's not a very nice way of doing it, but I had run out of time and didn't have time to get a nice doorway sprite drawn :) Had I done so then I would have removed those 2 stone tiles, and then put a nice looking doorway in instead, and simply tested for player overlap with that sprite. Which I gather is what you've done anyway, so nice one :)

Cheers,

Rich

http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: .net mag Tutorial
« Reply #6 on: Sun, Jul 24, 2011 »
Sorry - missed this part - but the problem with tilemaps is that they work on purely rectangle bounding box based collisions. So a "spike shaped tile" will still collide on the edges, which isn't usually desirable. Personally I would loop through the map data when the level is created, and replace them all with spikey sprites which you can do a pixel perfect test against using the power tools.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

arcade27

  • Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: .net mag Tutorial
« Reply #7 on: Mon, Jul 25, 2011 »
Ill look into that tomorrow sofar weve just been playing XD
MY whole inabuility to draw means 2bit game s:3



arcade27

  • Member
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: .net mag Tutorial
« Reply #8 on: Wed, Jul 27, 2011 »
ok going to keep all my nonsense issues to one thread.  Easier for every that way xD as there all related.

So I now have Slopes as an object,  very much how the stars in the tutorial have been done ( layer of star sprites in dame,  then parsed )

and then used import org.plugin.flixel.somthingelseifrogto.flxgcollision;

tried  flxcollision.pixrlerfeccollisions(player,BR_ramp);

and it laughed at me D: