Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Can't get my sprite moving.
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Razgriz




PostPosted: Tue Feb 24, 2009 6:54 am   Post subject: RE:Can\'t get my sprite moving.

Been working a lot on the map, and it's going great. Got everything that needs to be impassable that way, so...

Thanks :}
Sponsor
Sponsor
Sponsor
sponsor
Razgriz




PostPosted: Tue Feb 24, 2009 1:24 pm   Post subject: RE:Can\'t get my sprite moving.

Question: How do I change the red square back to my sprite?
DemonWasp




PostPosted: Tue Feb 24, 2009 2:41 pm   Post subject: RE:Can\'t get my sprite moving.

Look for the Draw.FillBox command in the main loop. Comment that out, and replace with a Pic.Draw ( playerPic ... ) command - fill it in yourself. Don't forget to multiply by GRID_SIZE, or it won't line up with the grid.
Razgriz




PostPosted: Tue Feb 24, 2009 5:07 pm   Post subject: RE:Can\'t get my sprite moving.

I commented all this noise:
Turing:

  Pic.Draw (background, 0, 0, picCopy)
        for x : 1 .. mapCols
                for y : 1 .. mapRows
                        if map (x, y) = MAP_IMPASSABLE then
                                %Draw.FillBox ((x - 1) * GRID_SIZE, (y - 1) * GRID_SIZE, x * GRID_SIZE, y * GRID_SIZE, grey)
                        end if
                end for
        end for


        % Draw some rulers to guide us (if we're debugging)
       /* if DEBUG then
                for x : 0 .. maxx by GRID_SIZE
                        Draw.Line (x, 0, x, maxy, black)
                end for
                for y : 0 .. maxy by GRID_SIZE
                        Draw.Line (0, y, maxx, y, black)
                end for

                var mouseX, mouseY, mouseButton : int
                Mouse.Where (mouseX, mouseY, mouseButton)
                put "(X, Y) = (", mouseX div GRID_SIZE + 1, ", ", mouseY div GRID_SIZE + 1, ")"

        end if*/


        % Note: multiplying the player coordinates (which are coordinates to the grid) by the size of each grid square.
        % You can also use an offset (I believe your code has a bgX and bgY) to move the entire display. I'll let you figure that out.
        Draw.FillBox ((playerX - 1) * GRID_SIZE, (playerY - 1) * GRID_SIZE, playerX * GRID_SIZE, playerY * GRID_SIZE, 12)
        View.Update ()
        Time.DelaySinceLast (100)         % Slow us down just a little
end loop


and it makes the grid invisible but still operates... but now I'm confused. O-o
Razgriz




PostPosted: Wed Feb 25, 2009 6:51 am   Post subject: RE:Can\'t get my sprite moving.

Disregard, I managed to figure that one out...

Thanks to the assistance of DemonWasp, I'm not set to start making multiple maps...(Yay?)

Maybe someone can help me with that.
DemonWasp




PostPosted: Wed Feb 25, 2009 8:14 am   Post subject: RE:Can\'t get my sprite moving.

Re: Commenting all of that out: You don't need to. Notice it says "if DEBUG then ..." ? Just set DEBUG to false at the top of the file.

Multiple areas soon.
Razgriz




PostPosted: Wed Feb 25, 2009 9:20 am   Post subject: RE:Can\'t get my sprite moving.

Awesome.

Thanks mate :}

Now, I'm at school.

I had a question, but I forget...


Um. . .

Let me think, I should remember soon.
saltpro15




PostPosted: Wed Feb 25, 2009 9:24 am   Post subject: RE:Can\'t get my sprite moving.

@Razgriz, I go to e.l. crossley, we got the day off Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Razgriz




PostPosted: Wed Feb 25, 2009 9:32 am   Post subject: RE:Can\'t get my sprite moving.

You suck >W< I wish I had the day off.

Anyway I believe my question was...
is going into a house the same as going onto a new map?
saltpro15




PostPosted: Wed Feb 25, 2009 9:36 am   Post subject: RE:Can\'t get my sprite moving.

depends on how you load your maps, but I hear fallout 3 calling me so hopefully DemonWasp can do a better job answering than I can
Razgriz




PostPosted: Wed Feb 25, 2009 9:41 am   Post subject: RE:Can\'t get my sprite moving.

Yes, he seems to be good for that. XD
DemonWasp




PostPosted: Wed Feb 25, 2009 11:33 am   Post subject: RE:Can\'t get my sprite moving.

There are a few different styles that RPGs seem to choose between. I'll list the ones that I've seen before; if you know of others you can also list them. Once you choose a type, we can start on a proper design for how to handle multiple areas.

Type A
This is the simplest type (easiest to implement, but least usable). It's common in older handheld RPG games.

In this type, all areas are of a given size (we have 40x40 at this point). Whenever the player exits the map to the North, South, East or West, there's another area there that gets loaded and displayed. The areas are arranged in a grid, which makes determining where to go next easy.

This method does not handle stairs particularly well as the only way to leave the area is via the edge of the area, and it's a little inflexible (doesn't let you have areas larger or smaller than the default). Entering any building is equivalent to just walking into a closed-off area by an entrance, like the following:

code:

.....
.XXX.
.X.X. <-- in the middle space there is "inside" the building. It's not that special.
.X.X.


Type B
As Type A, but there are also special squares that transport you to a new area (for example, stairs, teleporters, ships...). This adds quite a bit of complexity, but also adds considerable realism.

This method is still inflexible because it requires you to constrain all areas to the size you've already decided on, or split them over multiple "areas".

Entering a building can happen in multiple ways in this type. Either you can handle it like Type A (the walls are impassable, the door is not) or you can handle it as if the door was a staircase (transports you to a new area for the interior) - the second choice is a little like the Baldur's Gate / BG2 / Neverwinter Nights / NWN2 method.

Type C
As Type B, but in addition, areas can be of variable size. This is the most complicated option, but also the most flexible. This is the exact type used by BG/BG2/NWN/NWN2.

Warning: you're starting to get quite a bit more complicated, regardless of which of the above you choose. I recommend doing some of the excellent Turing Walkthrough/tutorial to strengthen your core understanding before we proceed.

The implementation of Type A is probably most simply done with Turing's records (see the tutorials...). Type B and C are probably better done with classes.
Razgriz




PostPosted: Wed Feb 25, 2009 11:40 am   Post subject: RE:Can\'t get my sprite moving.

Alright.

For the basicness of my game I would stick to A, simply because Ican manage to keep all areas the same size.

Doesn't matter too much at this point about realism for me, I just want to make a game.

Perhaps in time I'll update my game to another movement type.
Razgriz




PostPosted: Wed Feb 25, 2009 1:12 pm   Post subject: RE:Can\'t get my sprite moving.

Computer system at school @#$%ed me over, lost my file from it so I got the previous from portable drive...

Now when I try to get it to draw my sprite it says 'playerPic' cannot have subscripts..


Whats' happened?
Razgriz




PostPosted: Wed Feb 25, 2009 1:15 pm   Post subject: RE:Can\'t get my sprite moving.

Nevermind, I got it... but whatever the hell the computer did, it totally destroyed my entire file and everything in it.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 4 of 5  [ 71 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: