Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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  
  Views  (Read 1587 times)
0 Members and 1 Guest are viewing this topic.
Offline Geemili

Junior Member


Projects: 1


No Games Finished


« Posted 2012-02-17 14:49:37 »

I am making a game(no duh) using slick2d. Right now, I am trying to figure out how to make a view. I don't know how others do it, but I started thinking that I could give each entity a normal x and y, and a drawing x and y. I don't really wan't to do that, because it sounds like a lot of writing and I am kind of lazy. Any help would be appreciated!
Offline antelopeDJ

Junior Member


Projects: 2


Java Developer on the Weekends!


« Reply #1 - Posted 2012-02-17 18:36:27 »

If you would care to elaborate on what you want help with, I'd gladly help you. But 'setting up a view' is a tad to vague to get a decent answer.
Offline RylandAlmanza

Junior Member


Medals: 3



« Reply #2 - Posted 2012-02-17 21:22:14 »

If you're trying to use a camera, you can put this at the beginning of your games render function:
1  
gr.translate(player.x, player.y);


That will make the camera follow your player (But he will be at the top right corner of the camera. You might want to center it.)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #3 - Posted 2012-02-17 23:58:07 »

Actually you may want to do gr.translate(-player.x,-player.y) since translating positive values moves the map to the right.

Then change this to:
1  
gr.translate(-(player.x-player.width/2) + screenWidth/2, -(player.y-player.height/2) + screenHeight/2);

To center Smiley

Offline Geemili

Junior Member


Projects: 1


No Games Finished


« Reply #4 - Posted 2012-02-18 00:13:53 »

Thank you! But I already knew how to do that. I just didn't know how to make the views. I used hard coded values instead of doing that, which would be a better way. Thank you two for you help.
Offline ReBirth
« Reply #5 - Posted 2012-02-18 03:39:09 »

Maybe the OP means a way to avoid manipulating x and y manually.

Offline Geemili

Junior Member


Projects: 1


No Games Finished


« Reply #6 - Posted 2012-02-18 05:13:05 »

I think that I am bad at posting understandable posts. I didn't know about the translate command, but I knew how to center it. I am really bad at making posts on forums.
Offline RylandAlmanza

Junior Member


Medals: 3



« Reply #7 - Posted 2012-02-18 07:30:49 »

Don't be too hard on yourself. I'm pretty bad at posting understandable content too. That's dog the fork for ten hababa indigo. If ael a;m efk slse, foin. adelfj ielomf awof, oq? ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Online ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #8 - Posted 2012-02-18 08:07:15 »

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Is that Brainf**k code? I ran that and it said "Hello World!" hehehehehe Grin

Offline RylandAlmanza

Junior Member


Medals: 3



« Reply #9 - Posted 2012-02-19 00:18:42 »

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Is that Brainf**k code? I ran that and it said "Hello World!" hehehehehe Grin
Lol, you got it! Maybe I'm getting better at making understandable posts! Smiley
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Online ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #10 - Posted 2012-02-19 00:21:35 »

That's dog the fork for ten hababa indigo. If ael a;m efk slse, foin. adelfj ielomf awof, oq?
I don't get this part though.......

Offline Cero
« Reply #11 - Posted 2012-02-19 01:36:30 »

you have to code a "camera"

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (74 views)
2013-05-17 21:29:12

alaslipknot (86 views)
2013-05-16 21:24:48

gouessej (115 views)
2013-05-16 00:53:38

gouessej (110 views)
2013-05-16 00:17:58

theagentd (121 views)
2013-05-15 15:01:13

theagentd (110 views)
2013-05-15 15:00:54

StreetDoggy (155 views)
2013-05-14 15:56:26

kutucuk (177 views)
2013-05-12 17:10:36

kutucuk (174 views)
2013-05-12 15:36:09

UnluckyDevil (184 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.113 seconds with 20 queries.