Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / How do I make array based movement with sprites?

Author
Message
DKnightX
User Offline
Joined: 28th Jan 2017
Location: Earth
Posted: 13th Feb 2017 16:56
Hi. I was wondering how I might be able to create an array that I can apply sprites for a 2D "game" that im making. I have very limited experience with DBP, but enough to implement things such as sprite animations and crappy free movement. Can someone plz help me?
CodeName
User Offline
Joined: 30th Dec 2016
Location:
Posted: 15th Feb 2017 00:12 Edited at: 15th Feb 2017 00:33
Way Points... pointA(X,Y)----pointB(X,Y)---pointC(X,Y)

DBPro has Vec2.. use those.. you can read from them, two integers.

Hope that helps.
DKnightX
User Offline
Joined: 28th Jan 2017
Location: Earth
Posted: 15th Feb 2017 01:39
How would I create the array for it?
Im still kind of a noob to 2D programming so it would help if you could explain it, if you dont mind.
CodeName
User Offline
Joined: 30th Dec 2016
Location:
Posted: 15th Feb 2017 06:19 Edited at: 15th Feb 2017 06:47
There is A* look at it and make it better.. best way to go.
CodeName
User Offline
Joined: 30th Dec 2016
Location:
Posted: 15th Feb 2017 20:56
I'll do a tutorial later this week.
DKnightX
User Offline
Joined: 28th Jan 2017
Location: Earth
Posted: 17th Feb 2017 05:28
"There is A* look at it and make it better.. best way to go."

Whats that suposed to mean? A*? What?
CodeName
User Offline
Joined: 30th Dec 2016
Location:
Posted: 18th Feb 2017 09:54
Google A*

One thing your going to have to do to become a better programer is to dissect code.

Look at this post, this will help you to point objects and sprites..

https://forum.thegamecreators.com/thread/744

After you figure how to point, point a sprite in any xy location then move in that direction. Utilizing newxvalue () and newyvalue ().

Get also the "distance function".
Use it to know how far you have to travel.
Xy----------------distance-----------xy

This might take you as a noob a few days to master.

You'll get it.. peace.
Phaelax
DBPro Master
14
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Agartha
Posted: 22nd Feb 2017 16:19
By array movement, do you mean the character can only move to certain locations? (waypoints, as CodeName has said)

Define what a waypoint is. In our case, it's only a location.
Type Waypoint
x as float
y as float
EndType


Create an array for waypoints:
waypoints as Waypoint[10]

Define the waypoint locations:
waypoints[1].x = 10 : waypoints[1].y = 8
waypoints[2].x = 185 : waypoints[2].y = 75
waypoints[3].x = 68 : waypoints[3].y = 123



Point your character to the location of a specific waypoint then move forward until you reach it!

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
CodeName
User Offline
Joined: 30th Dec 2016
Location:
Posted: 23rd Feb 2017 14:05
I think he means something like this

For T= 1 to 10
Position Sprite(T,waypoint[T].x,waypoint[T].y)
Next T

I also think he wants to define the locations in an "array" such as in a memblock.
...10,8,185,75,68,123

maybe he wants to build a world out of sprite blocks???

Login to post a reply

Server time is: 2017-09-20 04:54:55
Your offset time is: 2017-09-20 04:54:55