Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Battleship game
Old
boondocks
Guest
 
Status:
Posts: n/a
Default Battleship game - 05-16-2011, 05:57 PM

ive been working on trying to design the game battleship, my experience with this program is mediocre and i can't figure out a few things


my world consist of a 72 squares facing down with walls separating two 36(6x6) square grids

13 14..............
7 8 9 10 11 12
1 2 3 4 5 6


So...
PLayer 1
C4=square 16
B5=square 11
Player2
C4=square 52
B5= square 47

I can't figure out how to ask user to place the ships to certain squares
I have had some ideas like type in the coordinates, or clicking on squares and enabling only the next logical boxes to be clicked next but can't get anything to work properly. I also thought about grouping (say the motorboat to two invisible squares) to the users two selected squares, but trying to orient the group to a certain position isn't working.

If anybody has some tips or ideas on how to ask the user to place ships so that they show on their grid I would be very appreciative.
Thamks
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 05-17-2011, 05:30 PM

You could use the event "let user move object with mouse" and then let the user drag the ship into position and then test its position and have it "snap" to corresponding squares. This seems very complicated though.


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
boondocks
Guest
 
Status:
Posts: n/a
Default 05-25-2011, 03:48 PM

is there any way that i can move the ship with the arrow keys and make it only move within the grid... like stopping when the ship moves left at last square where the wall is. when i mess around with the camera it won't move through these walls. I was wondering if this same concept could be applied here.
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 05-25-2011, 04:14 PM

How about this: Click the ship to select it. Then the ship gets placed at (1,1) on the grid and you use the "when a key is pressed" to make the ship move one tile at a time. You're going to need to keep counters and use alot of if/else statements to make sure the ship is in bounds. I would rather use coordinates to keep track of the position rather than testing for proximity. Then you can have <SPACE> rotate the ship. If the ship can be placed, color it green; if it can't be placed, color the ship red. Then have the user press <ENTER> to have the ship go to it's final position (only if the ship is green.)


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
boondocks
Guest
 
Status:
Posts: n/a
Default 05-30-2011, 03:54 PM

hey im still trying to figure this game out and ended up setting up a boundary around my grid to keep the ship inside. The problem is that on the squares in the Y direction will block out the ship from moving past it, but the squares in the X direction wont. i posted what i have so far. the boundary will end up being invisible and the walls will be up. I still want to place the ships on the grid and have tried to come up with if statements to track the location of the ship(not in this world though) but can't really find a solution. Ideally i want to have 1-1 square ship, 1-2 square ship, and 1-3 square ship. If any body has any ideas for this part of my program i would be grateful.
Attached Files
File Type: a2w thegame.a2w (523.9 KB, 16 views)
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 05-30-2011, 08:45 PM

Interesting....I might review it once it is completely finished


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
heeelp game issues
Old
boondocks
Guest
 
Status:
Posts: n/a
Default heeelp game issues - 06-13-2011, 05:46 PM

im still having problems with this game please if anyone can suggest anything,
I have tried to come up with a way to select a square from the grid but either it asks the question twice on wont run right also I made a way to pick the ships but taking that number and converting it to a square from grid isnt working.
Attached Files
File Type: a2w latest.a2w (1.21 MB, 6 views)
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.