Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Click here to join us on IRC (#charas on irc.freenode.net)!
Charas-Project
»
Off-Topic
»
Archive
»
Really Old Stuff
»
General programming
»
GML Picking up items
« previous
next »
Print
Pages: [
1
]
Author
Topic: GML Picking up items (Read 2704 times)
Kilyle
Because one language is never enough
Associate
Posts: 188
45; bard, lifelong learner, published author
GML Picking up items
«
on:
April 09, 2004, 06:54:44 PM »
This is getting really annoying. Using Game Maker 5 and GML (which I think I understand pretty well and have already completed a short game in) I'm working on a game similar to Harvest Moon. But in order to get there, I need basic person-item interaction that doesn't use collisions! Here's my problem.
I want to place the hero and the item on a map, and be able to move the hero to the item, face the item, and pick it up using space bar, then go somewhere else and put it down again using space bar. I don't want to use snapped to grid because I'd like to be able to be offcenter a bit and still pick it up--though I may have to resort to gridwork.
I have no trouble making the character move and giving him the correct sprites and everything. But I tend to 1) run through the item, 2) register no item when I try to check next to me, 3) move myself to the item screen instead of the item (and I swear I wasn't referencing the Hero object at the time...), and/or 4) register that I never picked up an item although I already had.
So I want a simple example of how to move next to an item and pick it up (and shift it or a stretched graphic of it to an item screen, for right now the 0,0 corner of the map).
If you want to see my code to figure it out, let me know; otherwise, if you have an example, please help me!
Logged
I have a website now! Currently just points at my fanfics (over 230 works, totaling over 750,000 words, mostly in Marvel and Person of Interest and now Lackadaisy too). YouTube channel on hiatus but I hope to eventually recreate "A Fugitive in Stardew Valley" now that I know how to mod the game.
Supernicky
blond haired hero & MODIFIER
Initiate
Posts: 23
SUPERNERD :D
(No subject)
«
Reply #1 on:
April 14, 2004, 10:40:31 AM »
for the grid use in step event of the item:
gridsize=32
x=floor(room_width/gridsize)
x*=gridsize
you can change the gridsize easily
running through the item can be stopped by making the item and hero solid.
you can store the items in a array.......
create event:
itemcount=0
when picking up the item:
itemcount+=1
item[itemcount]="sword"
hope i helped you on your way
why don't you wanna use collisions??
Logged
Kilyle
Because one language is never enough
Associate
Posts: 188
45; bard, lifelong learner, published author
Why no collisions?
«
Reply #2 on:
April 20, 2004, 10:54:55 PM »
Do you normally collide with items to pick them up in RPGs?
I know in games like Zelda you do, but I'm thinking more like BoF-style treasure chests, or items in the Harvest Moon garden. You can't just run into them to pick them up--you have to face the item and push a button, and at that point the game must figure out whether you're actually facing an item that you can interact with. There's no collision involved (unless you're seeing something that I'm not).
Thanx for the advice, tho. (I do know how to use an array; that part wasn't the thing that was malfunctioning, it was something else. I was actually using a "map," I think, at the time...I'll have to go back over my code to figure out what was going on.)
Oh, and I did finally get it working! Now I can make a tiny RPG with item interaction and person interaction (talking to other characters). The code's not as elegant as I'd like, but I think I'll use scripts to remedy that.
Logged
I have a website now! Currently just points at my fanfics (over 230 works, totaling over 750,000 words, mostly in Marvel and Person of Interest and now Lackadaisy too). YouTube channel on hiatus but I hope to eventually recreate "A Fugitive in Stardew Valley" now that I know how to mod the game.
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Off-Topic
»
Archive
»
Really Old Stuff
»
General programming
»
GML Picking up items