http://calcg.org/newlogo2.png Not Logged in.
Login | Register

General Discussion Board \ Calculator Programming \ Making A New Game! Need a movement engine: details inside.

Click here to log in (you must be logged in to post comments).

AuthorComment
turtlbrdr
Marine
Posted: 3 Dec 2007
19:01 GMT
Total Posts: 39
I am making a new game it's called Private Island. Your a character who lives on a private island and you need to find yourself a wife to continue your family for as many generations as you can. It will include two modes: free and life. In free mode you have as many days to accomplish this as you want, but in life mode you only have a set amount of days to find yourself a wife. Besides the point, I need a movement engine. I devised a simple system to move the character around. (keep in mind this is only the prototype ME I will be using a more sophisticated approach in the main program, but it will run basically the same, I hope.)

:Delvar K:1>X:1>Y
:Repeat K=22
:ClrHome
:Output(4,5,"-")
:Output(X,Y,"*")
:Delvar K
:While K=0
:getKey>K
:End
:If K=25:Then
:X-1>X
:End
:If K=24:Then
:Y-1>Y
:End
:If K=34:Then
:X+1>X
:End
:If K=26:Then
:Y+1>Y
:End
:End

The character moves around fine, but as you can see (if you do this on you calc.) the character will go through the - I don't want that, so I need something to prevent that from happening. So if you have any ideas, lets here them!

EDIT: After looking at the Pokemon Purple program, I guess what I REALLY need is a hit detection program.

---
Head, and only, programmer of StarAeritha Productions
Hydraliskisback
Wraith
avatar
Posted: 4 Dec 2007
07:53 GMT
Total Posts: 583
heres what i do, i use a matrix that shows where collisions are.
1's are for non moveables. 0's are.
so in a matrix like this
[[0,0,0][0,1,0][0,0,0]]->[A]
only the middle is unpassable. but you may want to save memory. so here's how you do it.
add this to your code.
im writing this under the assumption the "-" is at coordinates 4,5
4 is x 5 is y
:getKey>K
:End
:If K=25
:Then
:if Y=5 and X=5
:goto D
:X-1>X
:End
:If K=24
:Then
:if Y=6 and X=4
:goto D
:Y-1>Y
:End
:If K=34
:Then
:If X=3 and Y=5
:goto D
:X+1>X
:End
:If K=26
:Then
:If X=4 and y=4
:Y+1>Y
:End
:LblD
:End

now thats specific if you're looking for something thatll work with everything, you should look into my matrix form.

---
Iff Hydralisk has posted the above, the above is stupid.
turtlbrdr
Marine
Posted: 5 Dec 2007
03:48 GMT
Total Posts: 39
Thanks, though i think it might just take to much memory and space where i'm concerned, I should have mentioned that the game will be played in screen-side windows, and won't scroll with the character. So this ends up meaning I have about 25 16x8 character windows.

---
Head, and only, programmer of StarAeritha Productions
turtlbrdr
Marine
Posted: 5 Dec 2007
16:44 GMT
Total Posts: 39
Yeah I checked today, It would take just too much memory...

---
Head, and only, programmer of StarAeritha Productions
tifreak8x
Administrator
avatar
Posted: 7 Dec 2007
09:33 GMT
Total Posts: 419
Click here

Check out that tutorial, might give you what you need.

---
Bringing you Pokemon, for your calculator.





Portal | My Account | Register | Lost Password or Username | TOS | Disclaimer | Help | Site Search | File Archives Copyright © 2002-2019 CalcG.org