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! / 2d help!

Author
Message
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 18th Mar 2004 22:47
This is the first time i'm using 2d in a game (i usually use 3d), and i have a few questions:

- i want to have something like an over view of the character and have the character be able to move in all 4 directions. what do i do to turn to sprite and have to move in another direction?
- how do i make the map move with the screen but not mess up the x and y coordinates of the sprites and images? (like a scrolling map)
- i have a 12 frames image (1-3 left walk, 2-6 right walk, etc...) but when i tell it to do those frames (play sprite 1, 4,6, 2), it won't switch to those frames. how do i get it to do that?
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 19th Mar 2004 22:15
can anyone answer those questions? or at least show me a tutorial that has those in there?
Jadelion
22
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 20th Mar 2004 11:12
Wow, I can't believe no one answered. (I was going to but my answer kept getting huge and I'd get distracted) So here is a simple answer. the MOVE SPRITE command moves your sprite at a given velocity, it's default angel is 0 so your sprite will move straight up. If you are indeed familiar with 3d programming the ROTATE SPRITE command operates the same as the rotate object command. Now as you only want 4-direction movment, you will need to adjust the angle values. Here is some sample code. There are no comments but I'll explain more if necessary.



BOX 0,0,75,75
get image 1,0,0,75,75
cls


SPRITE 1,320,240,1
CREATE BITMAP 1,100,100
SET CURRENT BITMAP 0

DO
x=SPRITE ANGLE(1)
SET CURRENT BITMAP 1
SET CURSOR 0,0
PRINT x
get image 100,0,0,20,20
SPRITE 2,0,0,100
SET CURRENT BITMAP 0

IF UPKEY()=1 AND x=90
rotate sprite 1,0
move sprite 1,1
ENDIF
IF UPKEY()=1 then move sprite 1,1
if downkey()=1 AND x = 90
ROTATE SPRITE 1,0
ENDIF
IF DOWNKEY()=1 then move sprite 1,-1
IF RIGHTKEY()=1 and x=0
rotate sprite 1,90
ENDIF
IF RIGHTKEY()=1 then move sprite 1,1
IF LEFTKEY()=1 AND x=0
rotate sprite 1,90
ENDIF
IF leftkey()=1 then move sprite 1,-1
LOOP
LOOP

...that move was indeed...Bold.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 20th Mar 2004 19:59
ok, i'll try that. thanks

what about any of the other questions i asked. about the scrolling screen without losin coordinates of sprites for collision or the frames not messing up?
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Mar 2004 21:02
I don't like sprites to be honest. I prefer plains, or images. Then its easy just to move the camera around.

Jadelion
22
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 20th Mar 2004 22:15
Oh, there shuldn't be that extra LOOP command at the end. To do SPRITE animation and collision control, I typicaly use a different method of movment. I'm sure there is a way to detect movment using the MOVE sprite command, but it seems more complicated to me. what I would do, is just redarw the sprite completely with the SPRITE command.( I know this seems strange compared with my other post, but there are lots of ways to do everything). you should endup with somthing like this. (this is just the movment and animation loop)



...that move was indeed...Bold.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 20th Mar 2004 22:30
Quote: "I don't like sprites to be honest. I prefer plains, or images. Then its easy just to move the camera around."


I thought about that before, but then i thought about that using the camera would take up more ram than just using 2D.
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Mar 2004 23:49
I don't think that the camera uses much ram.

Jadelion
22
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 21st Mar 2004 04:24
yea, using the 3d plains technique should be fine as long as you control the level size and view-able polygons. (personaly I think plains are much easier then sprites, but I've been working with sprites to retain a traditional 2d style)

...that move was indeed...Bold.
UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 21st Mar 2004 21:35
this is what im using it works fine except for once you start moving you don't need to press the upkey to keep moving forward all you have to do then is turn left or right press down to slow down and up to speed up again. if you want to beable to stop completely once the upkey is let go see the thread "Using sprites with velocity#"




The search continues.

Current project - A space game
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 22nd Mar 2004 07:18
mmmm... i don't know, i kinda wanted to have that traditional 2d feel, like Jadelion said...
Jadelion
22
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 22nd Mar 2004 08:51
the difference between 3d palins and 2d Sprites is not very big. You should read the 2d "blue screen" tutorial, it explains methods for controling the background. (Don't use backsave)

...that move was indeed...Bold.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 22nd Mar 2004 22:24
i know that, i don't have a problem with the background. I want to know how to scroll the map without losing coordinates or sprite or other images on the screen that need to be moved along with the map.
Jadelion
22
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 23rd Mar 2004 03:21
I'm not sure what you mean loosing coordinates, but scrolling can be very complex (actually I've been trying to make a very simple scrolling program all day just to answer this question... and it took me quite awhile)

depending on the game you are making, how you do scrolling could change quite a bit. this example I've made is huge, but it shows a basic form of scrolling and hopefully isn't too hard to understand.
if you play with the "visx" and "visy" variables you should be able to see some scalabilty.. and hopefully slow the program down to a reasonable level.





...that move was indeed...Bold.

Login to post a reply

Server time is: 2025-08-09 02:12:23
Your offset time is: 2025-08-09 02:12:23