Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  The basic question  (Read 1229 times)
0 Members and 1 Guest are viewing this topic.
Offline Richie_Mole

Junior Newbie




Im a n00bie at this =(


« Posted 2004-06-30 12:03:48 »

O.k how do you make something move on the screen?  Huh  I have been trying so hard to get this right and have looked at many different ways but none of them seem to work properly or just do not work at all. I know you have to redraw the image when you want it to move but how can i do this? I have looked on every tutorial here but they don't give much detail about why they put that peice of code there. So please can some one help me?
Offline DrBizzar0

Junior Member




Raj raj!


« Reply #1 - Posted 2004-06-30 13:25:50 »

http://www.cokeandcode.com/info/tut2d.html
Offline Richie_Mole

Junior Newbie




Im a n00bie at this =(


« Reply #2 - Posted 2004-06-30 15:58:08 »

Nope doesn't really help it tells you in parts which is confusing for me. All i want to know is a good peice of code that makes a square move up and down on the screen. The rest il figure out when i come 2 it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2004-06-30 16:34:41 »

the game:

declare variables
make a buffer
load stuff

run as long as it makes sense

clear the buffer (or don't)
change variables accordingly to the input flags (logic)
draw the background on the buffer
draw the sprites on the buffer
draw the hero on the buffer (using those variables)
draw other stuff on the buffer
draw the buffer on the screen

repeat

---

in the input handler:

if key 'x' is down set the flag to 1
if key 'x' in not down set the flag to 0
if key 'esc' is down set "makes sense" to false Wink

---

That's the whole idea. Of course you need to know how to programm in java - otherwise you won't be able to do much.

弾幕 ☆ @mahonnaiseblog
Offline CodexArcanum

Senior Newbie




Games == Life


« Reply #4 - Posted 2004-06-30 16:38:22 »

Things don't really "move."  You just change their position a little bit every frame.  

Basically, just set the x and y position of it to somewhere onscreen, then increment it every loop.

The webpage he gave seems simple enough.  Just scroll to the movement section and it bascially puts it right there.

Every sprite has an x and y position variable, and you use that to tell it where to draw it at, then you change that variable when the loop restarts, so it appears to move.
Offline Richie_Mole

Junior Newbie




Im a n00bie at this =(


« Reply #5 - Posted 2004-06-30 16:49:30 »

yeah i know things don't move thats what i said in 1st post. I'll look at it again, i hate reading from my computer screen my eyes go funny. I need a TFT monitor (off topic  Lips Sealed).
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (9 views)
2014-10-02 14:36:20

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (48 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!