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 (290)
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  
  AI for 2D game like Flicky or Sonic  (Read 1069 times)
0 Members and 1 Guest are viewing this topic.
Offline Andre Lopes

Junior Member





« Posted 2013-03-18 03:34:38 »

Hi Guys!

I need a little help...
I have my first little game in java, which is basically a PACMAN.
I have a snake that the player controls, which can eat apples.

Now i inserted a little hawk and i want it to try to kills the player, but in a dumb way.

I wonder how can i start it ?
I read about A* , but i wonder if i should start with that...

What you guys Recommend?
Any Article anything at all, is a good start to me.
Offline HeroesGraveDev

JGO Wizard


Medals: 64
Projects: 8


Muahahahahahaha...


« Reply #1 - Posted 2013-03-18 05:20:11 »

You could try Dijkstra.

Offline Agro
« Reply #2 - Posted 2013-03-18 05:33:13 »

A* gives the most efficient path, as it contains some similarities between Djikstra and another algorithm. But I'm not sure if the most efficient path is what you want in terms of difficulty.

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline sproingie
« Reply #3 - Posted 2013-03-18 06:23:59 »

A* is Dijkstra with an added heuristic.  Or seen the other way, Dijkstra is A* with a constant heuristic.
Offline Andre Lopes

Junior Member





« Reply #4 - Posted 2013-03-18 13:45:02 »

Thanks for the fast replies guys!!!

Ok, im printing some dijkstra tutorials.
Hopefully i will be able to mix it with my jPanel Tongue

Offline Andre Lopes

Junior Member





« Reply #5 - Posted 2013-03-24 03:53:51 »

OK Guys, i searched for dijkstra and A* again.

And im going to make my own algorithm...
I will calculate which of the adjacents Squares will get me closer to the player and move it.
And then re-calculate it.

Its simple i think, but for a start its ok, i guess.... Tongue
Pages: [1]
  ignore  |  Print  
 
 

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 (65 views)
2013-05-17 21:29:12

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

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

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

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

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

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

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

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

UnluckyDevil (177 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.078 seconds with 22 queries.