Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Sprite Problems

Author
Message
hot_coder
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location:
Posted: 10th Dec 2004 06:46
I have been working for several months on a platform game and I have used sprites as platforms. The problem is that when my character is on top of a sprite the character can no longer walk left or right. The only thing I can do is jump.

My collision system is based on the tutorial in DB. What do I need to change or add

p.s. thanking you in advance
mr joe
21
Years of Service
User Offline
Joined: 12th Aug 2004
Location: Edinburger, Scotland. DBC
Posted: 13th Dec 2004 19:59 Edited at: 13th Dec 2004 20:00
I think that tuorial works by simply putting the sprite back to it's last position when you collide. If that's what you're doing then it's probably best to change your collision system. That system will only let you jump because any other movement results in a collision, so you don't move. Also just using the sprite collision function can be a pain as it's hard get it to work with more than one collision, eg the collision of your character with the ground, and say, with an enemy.

Though I haven't really done too much in the way of platform games myself, from what I've seen the easiest way is to use a tile system. Emporer Baal has a good tutorial on his site, I hope he dosen't mind me linking it.
hot_coder
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location:
Posted: 15th Dec 2004 04:11
tiling system is only useful for top down scrollers e.g. old zelda games (although I'm not sure what type of system will be used in the new zelda game. lol)
The only logical solution I can think of is to program invisible collisions at the point above the platforms, but this will surley lead to insufficient code.
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 15th Dec 2004 06:41
Tiling is the way to go. Have a look at the Mario games, its all done through tiles (you can see repeating patterns in the floors etc).

BTW I bet your problem is that you've some sort of gravity effecting your character, so when its jumped on a platform it might be 1 pixel in the platform, and since your platform has collision on it - you cant move left/right.

You should therefore only have gravity effecting your character when jumping, and position the player at the right coordinates when on platforms - assuming this is your problem (hard to say with no code).

However if I were you I'd use tiles.
pizzaman
hot_coder
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location:
Posted: 15th Dec 2004 07:10
I kind of get what you are saying, but do please provide some source code. What I have made from what you have said is when my character is on top of a sprite. There needs to be a new ground level programmed in. My jump code is simply the character jumping up about 80 pixels and returning to the previous level; unless its hit a sprite.
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 16th Dec 2004 22:39
Would provide some source code, but I don't have the time at the minute - maybe if I have some spare time.

Anyways if i'm reading this right, when the player's sprite hits the platform, place the sprite on the platform directly above where it's hit the platform sprite (you can do this by getting the player's sprite x ordinate and their height of the sprite - then add this to the platform's y position).

Now turn off the gravity bit of your code (I presume you have some flags for jumping), and you should be able to walk left and right - unless you have done walking left and right differently
pizzaman
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 20th Dec 2004 00:13 Edited at: 20th Dec 2004 00:14
Hi

I had some spare time, so I coded this short collision tutorial. It's fully commented (the hardest thing to do ), so I hope you have no problems understanding it - but if you do please post.



pizzaman
MickBerg
22
Years of Service
User Offline
Joined: 21st Feb 2004
Location:
Posted: 27th Dec 2004 05:54
Hey Pizzaman, thanks a lot for the platform tutorial. There were some useful bits in there for me. Maybe you would know how to put a background picture into a 2d game without it slowing down to a crawl?Thanks,

Mick Berg.
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 27th Dec 2004 22:56 Edited at: 27th Dec 2004 22:57
Hi Mick Berg

Erm...you haven't really given me anything to go on. Try and answer these questions to help me.

1. What are you trying do?
2. What type of game is it (platform, space shooter, etc)?
3. Does the background scroll - in how many directions?
4. Does your game use a lot of sprites/images on screen at once?
5. How slow is your game (fps)
5. Any chance to see the code?

Below is some code to show a few ways to display a background image continously, but not able to scroll



Note : I get 110 fps with Draw Style 4 (and I have a rubish graphics card)

pizzaman

Login to post a reply

Server time is: 2026-06-11 13:13:29
Your offset time is: 2026-06-11 13:13:29