Be a Supporter!

Platform Game Problem !

  • 624 Views
  • 13 Replies
New Topic Respond to this Topic
Nikholai-Chan
Nikholai-Chan
  • Member since: Mar. 15, 2009
  • Offline.
Forum Stats
Member
Level 03
Game Developer
Platform Game Problem ! 2009-05-18 11:24:51 Reply

Hey Newgrounds.

I'm trying to make a Platform game and im having some real problems with the ground/platforms and the walls. I'm new to AS2 and i'm only just starting to get my head round it. I have however used Flash for about 3 years now just this is my first shot at a fully working game and AS2.

I have my player, that works just i'm still trying to get his code fine. However i did some hit tests for 'Walls' and it didn't work. I also have a problem with my platforms when i jump. I can jump and walk on them just i can jump from under them and jump right through them which isn't what i want.

Can anyone help me out here? Links to any tutorials would be sweet as well.

Thanks for the help Newgrounds :D

~ Nik ~

Neo-13
Neo-13
  • Member since: Jun. 9, 2007
  • Offline.
Forum Stats
Member
Level 23
Programmer
Response to Platform Game Problem ! 2009-05-18 11:29:51 Reply

You need to post the relevent code, otherwise nobody will be able to help you.


BBS Signature
Makeshift
Makeshift
  • Member since: Jul. 17, 2008
  • Offline.
Forum Stats
Member
Level 32
Audiophile
Response to Platform Game Problem ! 2009-05-18 11:55:28 Reply

nuff said

WhoknowsmeaUdiO
WhoknowsmeaUdiO
  • Member since: Apr. 11, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Platform Game Problem ! 2009-05-18 12:22:07 Reply

At 5/18/09 11:55 AM, MakeshiftMovies wrote: http://www.newgrounds.com/portal/view/49 2360
nuff said

No. Not really. You just gave him the link that leads to a tutorial which teaches you how to copy & paste.


In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature
51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Platform Game Problem ! 2009-05-18 12:28:07 Reply

At 5/18/09 11:55 AM, MakeshiftMovies wrote: http://www.newgrounds.com/portal/view/49 2360
nuff said

this tutorial isn't very good and will get people into bad habits

@ OP post us some of your code and we will try and see what is going wrong

Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to Platform Game Problem ! 2009-05-18 12:30:28 Reply

At 5/18/09 11:55 AM, MakeshiftMovies wrote: http://www.newgrounds.com/portal/view/49 2360
nuff said

Worst response ever!

You should post what code you're using (or better yet, a clear summary) so we can help specifically. In general, though, here are a few points:

o Are you using a clip-to-clip or a shapeFlag hitTest? (i.e. hitTest(MovieClip) or hitTest(x, y, shapeFlag) - the former will just compare two bounding boxes, the latter checks a point but allows you to test against the shape of the object by setting shapeFlag to true

o Is your collision failing, or the code that executes when it occurs? To find out, stick a trace in after the condition - if the condition's being met then the trace will fire out

It's hard to be too specific without a clear idea of the problem.


BBS Signature
Makeshift
Makeshift
  • Member since: Jul. 17, 2008
  • Offline.
Forum Stats
Member
Level 32
Audiophile
Response to Platform Game Problem ! 2009-05-18 13:15:17 Reply

Well if he has no code to show us then maybe he just needs a tutorial on how to make one.

WhoknowsmeaUdiO
WhoknowsmeaUdiO
  • Member since: Apr. 11, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Platform Game Problem ! 2009-05-18 13:16:02 Reply

At 5/18/09 01:15 PM, MakeshiftMovies wrote: Well if he has no code to show us then maybe he just needs a tutorial on how to make one.

Well you didn't give him one, did you?


In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature
CaiWengi
CaiWengi
  • Member since: Sep. 17, 2004
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Platform Game Problem ! 2009-05-18 13:32:42 Reply

If your just starting out learning to code, I strongly reccommend you learn actionscript 3 instead of 2. But if you set on 2, then make sure you bookmark this :
AS: Main
A great selection of links to help out

Theres some specific platformer tutorials, but more useful is the other topics, have a good look through the basic section.


BBS Signature
51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Platform Game Problem ! 2009-05-18 13:36:28 Reply

At 5/18/09 01:16 PM, WhoknowsmeaUdiO wrote:
At 5/18/09 01:15 PM, MakeshiftMovies wrote: Well if he has no code to show us then maybe he just needs a tutorial on how to make one.
Well you didn't give him one, did you?

your reply is just as useless

AS 2: Main
there are loads of awesome tutorials here
1. Platformer Tut
2. Platformer Tut
3. Platformer Tut
4. Platformer Tut
5. Platformer Tut
6. Platformer Tut

i hope one of those helps, if not there are loads of tutorials in AS Main

and there are also These

Makeshift
Makeshift
  • Member since: Jul. 17, 2008
  • Offline.
Forum Stats
Member
Level 32
Audiophile
Response to Platform Game Problem ! 2009-05-18 13:49:45 Reply

At 5/18/09 01:36 PM, 51lver wrote: and there are also These

a lot of those are just Copy+Paste.

Nikholai-Chan
Nikholai-Chan
  • Member since: Mar. 15, 2009
  • Offline.
Forum Stats
Member
Level 03
Game Developer
Response to Platform Game Problem ! 2009-05-18 13:52:52 Reply

Wow loads of replys thanks everyone =]

The code i'm using for the ground is this one...

}
if (_root.ground.hitTest(_x, _y, true)) {
air = false;

...I tried re-wording it to make a wall hit test but failed. I don't know if i need to put the code on the wall or on the player it's self =/

Sorry i didn't put the code in the first post by the way, new to this =P

Thanks again.

~ NIk ~

WhoknowsmeaUdiO
WhoknowsmeaUdiO
  • Member since: Apr. 11, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Platform Game Problem ! 2009-05-18 14:05:12 Reply

At 5/18/09 01:52 PM, Nikholai-Chan wrote: Wow loads of replys thanks everyone =]

The code i'm using for the ground is this one...

}
if (_root.ground.hitTest(_x, _y, true)) {
air = false;

...I tried re-wording it to make a wall hit test but failed. I don't know if i need to put the code on the wall or on the player it's self =/

I think you should put it in the player MC, as that code checks if another MC touches THIS one, so with this, it means player so it should be in the player MC.

Well maybe it was just a copy/paste error, but you gotta close your if statement.
if(rr){
should be close with }

//example:
if(_x == _root.char._x){
_x --
}
// not:
if(_x == _root.char._x){
_x --

You should try making a wall MC on the frame, instance named as "wall1" and then put this code:

while (_root.wall1.hitTest(this._x, this._y+this._height/2-1+yspeed, true)) {
        yspeed--;
    }
    while (_root.wall1.hitTest(this._x-this._width/2+1+xspeed, this._y, true)) {
        xspeed++;
    }
    while (_root.wall1.hitTest(this._x+this._width/2-1+xspeed, this._y, true)) {
        xspeed--;
    }

Not too sure wether this works or not.


In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature
Nikholai-Chan
Nikholai-Chan
  • Member since: Mar. 15, 2009
  • Offline.
Forum Stats
Member
Level 03
Game Developer
Response to Platform Game Problem ! 2009-05-18 14:43:09 Reply

Wow thanks a lot for that mate =]

However i did some of those tutorials just now and i have been able to fix my wall problem very nicely. I also now have a working player [just getting the code how i want it] and working ground.

The only problem i still have right now is the ground can still be jumped through from below but i think i almost have that one fixed.

Thanks again everyone =]

~ Nik ~