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! / New at 2D

Author
Message
RisTar
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 4th Apr 2003 18:37
Hey , im new to 2d , i know the basic of the 3d but i want to start with a 2d release first . well my brother making players for Little Fighters 2
So ive asked him to make me a player walking f,b and he did it , now its a black screen with the player step after step , some one can post me a code and tell me how to move it in a black screen ? , just make it walk f. when i press rightkey() and b. when i press leftkey() ,, thanks !
Mogwai
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: United States
Posted: 4th Apr 2003 22:32 Edited at: 4th Apr 2003 22:33
Hi,

THe basic items to keep in mine when working in 2D is that there are two axes to work with. The X axis goes horizontal and Y goes vertical. The default resolution for DB programs is 640 by 480, so there are 640 pixels on the X axis and 480 on the Y axis. Pixel 0 of the X quadrant starts at the left of the screen, and pixel 0 of the Y quadrant starts at the top of the screen. Just thought I'd mention that before showing you how to move the sprite .

Here's some simple code that will move a 2D object left, right, up, and down with the corresponding keys. I've also added checks to ensure the object can't go outside of the screen. Instead of using actual values such as 640 and 480, you can also get the current screen width and height by using the screen width() and screen height() commands accordingly.



Hope this helps. Good luck!

RisTar
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 5th Apr 2003 05:15
Box 0,0,25,25 ,,,
25,25 its the size of the box of each movement ? ?
i got something like 20 images , all the images are in the same size ! so the 25,25 is the size of it ?
and another thing , the background of the images is black , if im gonna get a background behind my models , so it will be a black box , ?

Login to post a reply

Server time is: 2024-04-19 04:40:23
Your offset time is: 2024-04-19 04:40:23